biopython no module named Bio

a 夏天 提交于 2020-06-27 06:49:11

问题


FYI: this is NOT a duplicate!

Before running my python code I installed biopython in the cmd prompt:

pip install biopython

I then get an error saying 'No module named Bio' when try to import it in python

import Bio

The same thing happens with

import biopython     

It should be noted I have updated PIP and run python 3.5.2
I appreciate anyone's help.


回答1:


use this:

pip3 install biopython

and then import Bio worked for me




回答2:


When I came across this problem I noticed that after I installed biopython using pip install biopython the module directory in the site-packages folder was written with lowercase instead of uppercase letters. All in all, the folder was named bio instead Bio, so I just renamed the folder and everything started to work just fine. I am new to programing so I am aware this isn't the most elegant solution but it worked for me so I hope my answer will be useful to some of you. :)




回答3:


I just hit this issue with the problem being lower-case bio vs upper-case Bio. Turns out the problem was that it installs differently on python 2 and 3. In Python 2 you do import Bio, but in python 3 import bio. If you're hitting this issue it might be for the same reason, and the solution is probably to make sure you use the right name for the Python version you're on.




回答4:


On windows it installs the bio package in a top level directory named bio with lower case b. To fix the problem rename the directory to upper case b, Bio.

Obviously the biopython people don't pay much attention to the win




回答5:


Rename the site-package name from bio into Bio

C:\Users\user\Anaconda3\Lib\site-packages\bio

C:\Users\user\Anaconda3\Lib\site-packages\Bio

it works for me!




回答6:


pip3didn't fully work for me as there was a problem with importing a function.

conda install biopython 

✔️ worked for me.




回答7:


In my case (MacOS X Catalina, python 3.7.6 installed by brew), I had to install it with

python -m pip install Bio

(uppercase) but use it with

from bio import pairwise2

and the worse is that I had to change the code of the package: I went into python3.7/site-packages/bio/pairwise2.py, line 246, changed

from Bio import BiopythonWarning

into

from bio import BiopythonWarning

I hate changing the code of the package, on the next update it won't work again… Please do something to fix this bio/Bio issue.




回答8:


I had the same error. it turns out

import Bio

works

instead of import biopython !




回答9:


In my case, i got an error while trying to install BioPython, "BioPython requires python version greater than 3.6"

So installing the latest version fixed it for me.



来源:https://stackoverflow.com/questions/49848517/biopython-no-module-named-bio

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