简体   繁体   English

anaconda 中的 biopython,而不是 jupyter notebook

[英]biopython in anaconda, not jupyter notebook

I am trying to install biopython in Jupyter Notebook, Anaconda, Ubuntu 16.04.我正在尝试在 Jupyter Notebook、Anaconda、Ubuntu 16.04 中安装 biopython。 I follow the procedure in biopython website and it runs on python.我遵循biopython 网站上的程序,它在 python 上运行。

Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import Bio
>>> 

However, it does not work on Jupyter Notebook.但是,它不适用于 Jupyter Notebook。

from Bio.PDB.PDBParser import PDBParser

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-ada1f75604ba> in <module>()
      1 # biopython testing
----> 2 from Bio.PDB.PDBParser import PDBParser

ModuleNotFoundError: No module named 'Bio'

conda list also how biopython installed. conda listconda list了 biopython 的安装方式。

biopython                 1.72             py36h04863e7_0    anaconda
blas                      1.0                         mkl    anaconda
ca-certificates           2019.1.23                     0  
certifi                   2019.3.9                 py36_0  
intel-openmp              2019.3                      199    anaconda
libedit                   3.1.20181209         hc058e9b_0  
libffi                    3.2.1                hd88cf55_4  
libgcc-ng                 8.2.0                hdf63c60_1  
libgfortran-ng            7.3.0                hdf63c60_0    anaconda
libstdcxx-ng              8.2.0                hdf63c60_1  
mkl                       2019.3                      199    anaconda
mkl_fft                   1.0.10           py36ha843d7b_0    anaconda
mkl_random                1.0.2            py36hd81dba3_0    anaconda
ncurses                   6.1                  he6710b0_1  
numpy                     1.16.2           py36h7e9f1db_0    anaconda
numpy-base                1.16.2           py36hde5b4d6_0    anaconda
openssl                   1.1.1b               h7b6447c_1  
pip                       19.0.3                   py36_0  
python                    3.6.8                h0371630_0  
readline                  7.0                  h7b6447c_5  
setuptools                40.8.0                   py36_0  
sqlite                    3.27.2               h7b6447c_0  
tk                        8.6.8                hbc83047_0  
wheel                     0.33.1                   py36_0  
xz                        5.2.4                h14c3975_4  
zlib                      1.2.11               h7b6447c_3  

Is there any reason why it is not working?有什么原因使它不起作用吗? I appreciate any help.我很感激任何帮助。

Turns out the solution is to install Jupyter Notebook in the anaconda environment first.原来的解决方案是先在 anaconda 环境中安装 Jupyter Notebook。

conda install -c anaconda jupyter
conda install -c anaconda biopython

Now biopython could be called within the environment.现在可以在环境中调用 biopython。

open anaconda navigator,click on environments,choose not installed,search the biopython package in the search box.打开anaconda导航器,点击环境,选择未安装,在搜索框中搜索biopython包。 select biopython to install.选择 biopython 进行安装。

maybe you created a conda env using conda create -n xxx but have not added it to the jupyter kernel?也许您使用conda create -n xxx创建了一个conda env但尚未将其添加到 jupyter 内核中? (that means you install Biopython not in base conda env but you choose the base jupyter kernel ? (这意味着您不是在base conda env conda base conda env安装 Biopython,而是选择base jupyter kernel

try this cmd试试这个 cmd

conda activate your_biopython_env
conda install ipykernel
python -m ipykernel install --user --name your_biopython_env --display-name "your_biopython_env"

then refresh jupyter-notebook using F5 and change the kernel to your_biopython_env然后使用F5刷新 jupyter-notebook 并将kernel更改为your_biopython_env

can it work for u?它可以为你工作吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM