本文介绍了为什么在Python中安装软件包和模块不一样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想安装Biopython模块.因此,我使用了命令sudo apt-get install python-biopython.这将安装软件包.现在,如果我在Python中键入import Bio,编译器将找不到提供ImportError: no module named Bio模块.安装软件包并不意味着要安装模块吗?

I want to install the Biopython module. So I used the command 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. Doesn't installing the package imply installing the module?

推荐答案

由于您使用的是Python 3.4,因此无法使用,因为通过apt-get安装的Debian软件包仅会安装Python2.x版本.

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版本,我建议使用pip.这里是安装方法(请注意,该软件包可能没有Python 3版本):

To install the Python 3 version, I recommend pip. Here how to install (Note that this package may not have a Python 3 version):

如何在Python 3中安装pip?

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

If you still cannot get the import working on python2, try the following:

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

根据此软件包的文件列表,将安装文件进入一个特殊的目录,在默认的sys.path列表中看不到

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

这篇关于为什么在Python中安装软件包和模块不一样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 10:14
查看更多