簡體   English   中英

如何在Ubuntu16.04中安裝pylab?

[英]How to install pylab in Ubuntu16.04?

(GWAVA) wangshx@wangshx-KVM:~/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 我嘗試安裝最新版本,它提醒我更新許多模塊版本。 但是我需要控制模塊的版本。

當我運行別人編寫的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) wangshx@wangshx-KVM:~/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

有什么幫助嗎?

virtualenv是避免Python版本庫問題的常用方法。

從文檔中:

virtualenv是用於創建隔離的Python環境的工具。

解決的基本問題是依賴項和版本之一,以及間接權限。 假設您有一個需要使用LibFoo版本1的應用程序,但是另一個應用程序需要版本2。您如何同時使用這兩個應用程序? 如果將所有內容都安裝到/usr/lib/python2.7/site-packages(或平台的標准位置是什么)中,那么很容易在無意中升級不應升級的應用程序的情況下結束。

或更籠統地說,如果您要安裝應用程序並保留原樣該怎么辦? 如果應用程序正常運行,則其庫或這些庫的版本中的任何更改都可能破壞該應用程序。

我用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 

然后選擇一個似乎支持numpy17版本(例如1.3.0)。 在安裝1.3.0版本的matplotlib之后,它可以工作!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM