Anaconda安装没找到包

时间:2016-02-23 15:36:37

标签: python anaconda seaborn conda

通过我正在尝试做的事情以及正在发生的事情,最好地展示了这一点。

在我的python文件中,我想导入seaborn。

可通过conda安装。

(me_dev)[me@ip-***]$ conda install seaborn
Fetching package metadata: ....
Solving package specifications: ............................
# All requested packages already installed.
# packages in environment at /home/me/miniconda/envs/me_dev:
#
seaborn                   0.7.0                    py27_0

(me_dev)[me@ip-***** ****]$ which python
~/miniconda/bin/python

(me_dev)[me@ip-****]$ which ipython
~/miniconda/bin/ipython

现在,如果我启动iPython并导入seaborn:

In [1]: import seaborn
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-085c0287ecb5> in <module>()
----> 1 import seaborn

ImportError: No module named seaborn

此外,pip也不起作用。它不是从pip读取包。

(me_dev)[me@ip-*****]$ pip install jellyfish
Requirement already satisfied (use --upgrade to upgrade): jellyfish in /home/me/miniconda/lib/python2.7/site-packages

然而:

from jellyfish import jaro_winkler ImportError: No module named jellyfish

编辑: 在iPython

中,sys.path看起来如此
['',
 '/home/me/miniconda/bin',
 '/home/me/miniconda/lib/python27.zip',
 '/home/me/miniconda/lib/python2.7',
 '/home/me/miniconda/lib/python2.7/plat-linux2',
 '/home/me/miniconda/lib/python2.7/lib-tk',
 '/home/me/miniconda/lib/python2.7/lib-old',
 '/home/me/miniconda/lib/python2.7/lib-dynload',
 '/home/me/miniconda/lib/python2.7/site-packages/setuptools-19.6.2-py2.7.egg',
 '/home/me/miniconda/lib/python2.7/site-packages',
 '/home/me/miniconda/lib/python2.7/site-packages/cryptography-1.0.2-py2.7-linux-x86_64.egg',
 '/home/me/miniconda/lib/python2.7/site-packages/IPython/extensions',
 '/home/me/.ipython']

这是我的.bashsrc

(me_dev)[me@ip-**** ~]$ cat .bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# added by Miniconda 3.16.0 installer
export PATH="/home/me/miniconda/bin:$PATH"

# User specific aliases and functions
source activate me_dev

# added by Miniconda2 3.19.0 installer
export PATH="/home/me/miniconda/bin:$PATH"

1 个答案:

答案 0 :(得分:4)

我认为which python(和which ipython)应该指向~/miniconda/envs/me_dev/bin/,而不是~/miniconda/bin/目录。当您使用这些二进制文件启动python会话时,它们无法看到您的seaborn库,它可能只安装在环境站点包中。

我不确定你是如何在这种状态下结束的,但我建议你尝试建立一个新的环境,看看你是否最终指向了正确的二进制文件。

您的.bashrc组织是问题所在。您正在激活您的虚拟环境,但随后在您的bin中提供主miniconda $PATH目录优先级,这会使部分停用虚拟环境。