我是Python新手,需要使用一个名为chromosomer的基于python的工具来导入一些python包,包括bioformats。 Bioformats有许多模块,包括床。在运行chromosomer时,我收到错误:
smeeta:~$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import chromosomer
>>> from chromosomer.cli import bioformats
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/chromosomer/cli.py", line 8, in <module>
import bioformats.bed
ImportError: No module named bed
>>> import bioformats
>>> import bioformats.bed
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named bed
>>>
如何安装包装chromosomer及其相关包?
答案 0 :(得分:3)
使用pip
E.g。
#>pip install <desired package>
#>pip install chromosomer
官方pip
文档link。
适用于Python 2.7.9+和3.4 +
它应预先安装pip
Python2≤2.7.8且Python3≤3.3 按照此处的说明操作:https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip
有关此问题的更多讨论: Does Python have a package/module management system?
答案 1 :(得分:1)
所以在python中,大多数东西都是使用pip
命令安装的,这是一个用于安装Python包的推荐工具。
你也尝试过:
pip install python-bioformats
答案 2 :(得分:0)
对于除默认包以外的任何包,您需要在导入/使用它们之前安装它们。
安装Python包的最常用和最方便的方法是通过pip
包管理实用程序。
1. 安装点:
sudo apt-get install python-pip # for Debian/Ubuntu
sudo yum -y install python-pip # for CentOS/RHEL
注意:对于Python 2.7.9+和3.4 + pip
已预先安装。
2. 安装python包:
sudo pip install chromosomer
它会将bioinformats
,future
,pyfaidx
,PyVCF
,six
个软件包作为依赖项安装。
注意:如果已经是sudo
用户,或者使用root
,则无需vitualenv
。
验证 - 可以使用pip freeze
命令验证安装:
(venv_bioinformatics)[nahmed@localhost virtualenvs]$ pip freeze
bioformats==0.1.14
chromosomer==0.1.3
future==0.16.0
pyfaidx==0.4.8.1
PyVCF==0.6.8
six==1.10.0
wheel==0.24.0
测试 - 我安装了chromosomer并导入,工作正常:
(venv_bioinformatics)[nahmed@localhost virtualenvs]$ python
Python 2.7.5 (default, Sep 15 2016, 22:37:39)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from chromosomer.cli import chromosomer
>>>