安装Biopython:ImportError:没有名为Bio的模块

时间:2015-07-29 16:38:10

标签: python fedora biopython

尝试在Fedora 21,Python 2.7上安装Biopython。我已完成以下

hibernate.c3p0.maxStatementsPerConnection

然后

[mike@localhost Downloads](17:32)$ sudo pip2.7 install biopython
You are using pip version 6.1.1, however version 7.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting biopython
/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading biopython-1.65.tar.gz (12.6MB)
    100% |████████████████████████████████| 12.6MB 33kB/s 
Installing collected packages: biopython
  Running setup.py install for biopython
Successfully installed biopython-1.65

我做错了什么?

修改

我尝试使用

安装biopython
[mike@localhost Downloads](17:32)$ ipython
Python 2.7.9 |Anaconda 2.2.0 (64-bit)| (default, Mar  9 2015, 16:20:48) 

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

ImportError: No module named Bio

并将其安装到/usr/lib/python2.7/site-packages/biopython-1.65-py2.7-linux-x86_64.egg/中。没有工作。

然后我尝试使用相同的命令安装它,没有sudo:

sudo easy_install -f http://biopython.org/DIST/ biopython

将其安装到/home/mike/anaconda/lib/python2.7/site-packages/biopython-1.65-py2.7-linux-x86_64.egg

这有效!对于ipython和python都是如此。但为什么它有用......?

2 个答案:

答案 0 :(得分:1)

sudo pip这不是一个好习惯,因为它可能会在root权限下安装,这通常不会授予普通程序。

问题可能在于库路径。信息量最大的工具将是

import sys
print (sys.path)

which python
pip --version

并使用pip install biopython --user替换sudo pip

答案 1 :(得分:1)

在使用pip之类的时候应该非常小心,因为 pip与假设的Python解释器一起使用。

我看到您正在尝试通过键入Bio从您获得的Python解释器中导入ipython。您可以确保以这样的方式调用此解释器的pip

sudo ipython -m pip install biopython

请注意,安装不是 i python独有的。然而 是在ipython安装的任何Python安装上独有的。