2017-05-26 103 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版本後可以工作!