[英]Why installing package and module not same in Python?
I want to install the Biopython module. 我想安装Biopython模块。 So I used the command sudo apt-get install python-biopython
. 所以我使用命令sudo apt-get install python-biopython
。 That installs the package . 这将安装软件包 。 Now if I type import Bio
in Python, the compiler cannot find the module giving ImportError: no module named Bio
. 现在,如果我在Python中键入import Bio
,编译器将找不到提供ImportError: no module named Bio
的模块 ImportError: no module named Bio
。 Doesn't installing the package imply installing the module? 安装软件包并不意味着要安装模块吗?
I'm using 3.4.0 我正在使用3.4.0
Since you are using Python 3.4 it won't work because the Debian package you install via apt-get
will only install the Python2.x version. 由于您使用的是Python 3.4,因此无法使用,因为通过apt-get
安装的Debian软件包只会安装Python2.x版本。
To install the Python 3 version, I recommend pip. 要安装Python 3版本,我建议使用pip。 Here how to install (Note that this package may not have a Python 3 version): 这里是安装方法(请注意,此软件包可能没有 Python 3版本):
How to install pip with Python 3? 如何使用Python 3安装pip?
EDIT: 编辑:
If you still cannot get the import
working on python2, try the following: 如果仍然无法在python2上进行import
,请尝试以下操作:
import sys
sys.path.append('/usr/share/pyshared')
import Bio
According to this package's files list , the files are installed into a special directory I don't see in the default sys.path
list 根据该软件包的文件列表 ,文件被安装到一个特殊的目录中 ,该目录在默认的sys.path
列表中看不到
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.