Skip to main content
 首页 » 编程设计

python之为什么在 Python 中安装包和模块不一样

2025年05月04日39mfrbuaa

我想安装 Biopython 模块。所以我使用了命令 sudo apt-get install python-biopython。这将安装。现在,如果我在 Python 中键入 import Bio,编译器找不到给出 ImportError: no module named Biomodule。安装软件包不意味着安装模块吗?

请您参考如下方法:

I'm using 3.4.0

由于您使用的是 Python 3.4,因此它不会工作,因为您通过 apt-get 安装的 Debian 软件包将只安装 Python2.x 版本。

安装Python 3版本,我推荐pip。如何安装(请注意,此包可能没有 Python 3 版本):

How to install pip with Python 3?

编辑:

如果您仍然无法在 python2 上运行 import,请尝试以下操作:

import sys 
sys.path.append('/usr/share/pyshared') 
import Bio 

根据 this package's files list ,文件安装到我在默认 sys.path 列表中看不到的特殊目录