2017-05-26 42 views
0

(GWAVA) [email protected]:~/GWAVA_v1.0/src$ python gwava_paper.py Traceback (most recent call last): File "gwava_paper.py", line 19, in <module> from gwava import * File "/home/wangshx/GWAVA_v1.0/src/gwava.py", line 21, in <module> import pylab as pl ImportError: No module named pylab 如何安装pylab模块,我搜索它并发现它是matplotlib的一部分,但我不知道我应该安装哪个版本的matplotlib。我尝试安装最新版本,它提醒我更新许多模块版本。但我需要控制模块的版本。如何在Ubuntu16.04中安装pylab?

当我运行其他人写的一个Python脚本,我通过创建使用Anaconda一个新的环境控制模块的版本。

这是脚本文件。

The software requires the following python libraries (and their 
associated dependencies) to be installed. The version numbers used 
are identified, other versions may also work, but results may be 
slightly different. 

- numpy (1.7.0) 
- scipy (0.11.0) 
- pandas (0.12.0) 
- scikit-learn (0.14.1) 
- pybedtools (0.6.4) 
- tabix (0.2.5) 

我安装了所有的模块在README

(GWAVA) [email protected]:~/GWAVA_v1.0/src$ conda list 
dateutil     2.4.1     py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free 
libgfortran    1.0       0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free 
mkl      2017.0.1      0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free 
nose      1.3.7     py27_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free 
numpy      1.7.0     py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free 
openssl     1.0.2l      0 defaults 
pandas     0.12.0    np17py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free 
pip      9.0.1     py27_1 defaults 
pybedtools    0.6.4      <pip> 
python     2.7.13      0 defaults 
python-dateutil   2.6.0     py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free 
pytz      2017.2     py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free 
readline     6.2       2 defaults 
scikit-learn    0.14.1    np17py27_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free 
scipy      0.11.0    np17py27_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free 
setuptools    27.2.0     py27_0 defaults 
six      1.10.0     py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free 
sqlite     3.13.0      0 defaults 
tabix      1.0      <pip> 
tk      8.5.18      0 defaults 
wheel      0.29.0     py27_0 defaults 
zlib      1.2.8       3 defaults 

任何帮助?

回答

0

virtualenv是为了避免与Python库版本问题的常用方法。

从文档:

的virtualenv是创建孤立的Python环境的工具。

的基本问题正在处理是依赖关系和版本,并间接权限之一。想象一下你有一个需要LibFoo版本1的应用程序,但是另一个应用程序需要版本2.你怎么能使用这两个应用程序?如果您将所有内容都安装到/usr/lib/python2.7/site-packages(或任何平台的标准位置),那么很容易导致无意中升级不应升级的应用程序。

或者更一般地,如果你想安装的应用程序,并把它呢?如果应用程序有效,其库中的任何更改或这些库的版本都可能会中断应用程序。

+0

是啊,我用蟒蛇建立由Python编写的软件孤立的virtualenv。但问题是我不知道如何安装一个合适的pylab,并保持与同时提供的文档相同的版本。 –

0

我用conda search matplotlib找到matplotlib的所有版本。

  1.2.1    np17py33_0 defaults   
         1.2.1    np16py26_1 defaults   
         1.2.1    np16py27_1 defaults   
         1.2.1    np17py26_1 defaults   
         1.2.1    np17py27_1 defaults   
         1.2.1    np17py33_1 defaults   
         1.3.0    np16py26_0 defaults   
         1.3.0    np16py27_0 defaults   
         1.3.0    np17py26_0 defaults   
         1.3.0    np17py27_0 defaults   
         1.3.0    np17py33_0 defaults   
         1.3.1    np16py26_0 defaults   
         1.3.1    np16py27_0 defaults   
         1.3.1    np17py26_0 defaults   
         1.3.1    np17py27_0 defaults   
         1.3.1    np17py33_0 defaults 

,并选择一个版本(如1.3.0),似乎支持numpy17。它在安装matplotlib的1.3.0版本后可以工作!

相关问题