Why installing package and module not same in Python?

梦想与她 提交于 2019-12-13 19:32:58

问题


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?


回答1:


I'm using 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.

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

How to install pip with Python 3?

EDIT:

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

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



来源:https://stackoverflow.com/questions/30340573/why-installing-package-and-module-not-same-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!