[英]Install package from conda for a specific version of python
I'm relatively new on dealing with python libraries so it might be a stupid question but here is the detailed problem:我在处理 python 库方面相对较新,所以这可能是一个愚蠢的问题,但这里是详细的问题:
I'm working on Linux and trying to use a python program ( ORF-rater
) using python 3.7.我正在使用 Linux 并尝试使用 python 3.7 使用 python 程序(
ORF-rater
)。 Unfortunately, when I run the program, I get the following error:不幸的是,当我运行程序时,出现以下错误:
ImportError: cannot import name 'maketrans' from 'string'
which I think is related to this issue .我认为这与这个问题有关。 Therefore I want to use another version of Python (3.4 or 2.7 for instance) that will support this
maketrans
.因此,我想使用另一个版本的 Python(例如 3.4 或 2.7)来支持这个
maketrans
。
The program that I'm using also uses the Python package plastid
, which I installed using Conda conda install -c bioconda plastid
which I guess worked well.我正在使用的程序还使用 Python 包
plastid
,我使用 Conda conda install -c bioconda plastid
它,我猜它运行良好。
However, it installed the package on python 3.7 only, and I can't find a way to install for python 3.4 (I tried others things as pip3.4 install plastid
, but it did not work, most likely because I'm working on an university server and I don't have permission to do it).但是,它仅在 python 3.7 上安装了该软件包,并且我找不到为 python 3.4 安装的方法(我尝试了其他方法,例如
pip3.4 install plastid
,但它没有用,很可能是因为我正在研究大学服务器,我无权这样做)。
The following code creates an environment with a specific python version (2.7 since 3.4 was not an option ), then you activate it and install the package you need.以下代码创建了一个具有特定 python 版本的环境(2.7,因为3.4 不是一个选项),然后您激活它并安装您需要的包。
conda create -n test python=2.7
conda activate test
conda install -c bioconda plastid
python
Then in Python, I did the following and got no errors然后在Python中,我做了以下并且没有错误
from string import maketrans
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.