Python anaconda/conda - 安装特定的包版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38411942/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
anaconda/conda - install a specific package version
提问by s5s
I want to install the 'rope' package in my current active environment using conda. Currently, the following 'rope' versions are available:
我想使用 conda 在我当前的活动环境中安装“绳索”包。目前,可以使用以下“绳索”版本:
(data_downloader)user@user-ThinkPad ~/code/data_downloader $ conda search rope
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata: ....
cached-property 1.2.0 py27_0 defaults
1.2.0 py34_0 defaults
1.2.0 py35_0 defaults
1.3.0 py27_0 defaults
1.3.0 py34_0 defaults
1.3.0 py35_0 defaults
rope 0.9.4 py26_0 defaults
0.9.4 py27_0 defaults
0.9.4 py33_0 defaults
0.9.4 py34_0 defaults
0.9.4 py26_1 defaults
0.9.4 py27_1 defaults
0.9.4 py33_1 defaults
0.9.4 py34_1 defaults
. 0.9.4 py35_1 defaults
I would like to install the following one:
我想安装以下一个:
1.3.0 py35_0 defaults
I've tried all sorts of permutations of 'conda install' which I'm not going to list here because none of them are correct.
我已经尝试了“conda install”的各种排列,我不打算在这里列出,因为它们都不正确。
I am also not sure what the py35_0is (I'm assuming this is the version of the python against which the package was built?) and I also don't know what 'defaults' means?
我也不确定py35_0是什么(我假设这是构建包所针对的 python 版本?)而且我也不知道“默认值”是什么意思?
采纳答案by Wombatz
There is no version 1.3.0for rope. 1.3.0refers to the package cached-property. The highest available version of ropeis 0.9.4.
没有版本1.3.0的rope。1.3.0指包cached-property。的最高可用版本rope是0.9.4.
You can install different versions with conda install package=version. But in this case there is only one version of ropeso you don't need that.
您可以使用conda install package=version. 但在这种情况下,只有一个版本,rope所以你不需要那个。
The reason you see the cached-propertyin this listing is because it contains the string "rope": "cached-p ropeerty"
你看到的原因cached-property在此上市,是因为它包含字符串"rope":“缓存-P绳erty”
py35_0means that you need python version 3.5for this specific version. If you only have python3.4and the package is only for version 3.5you cannot install it with conda.
py35_0意味着您需要3.5此特定版本的python版本。如果您只有python3.4并且该软件包仅适用于版本3.5,则无法使用 conda 安装它。
I am not quite sure on the defaultseither. It should be an indication that this package is inside the default conda channel.
我也不太确定defaults。它应该表明此包位于默认的 conda 通道内。
回答by Christopher
To install a specific package:
要安装特定的软件包:
conda install <pkg>=<version>
eg:
例如:
conda install matplotlib=1.4.3
回答by Jonathan L
If any of these characters, '>', '<', '|' or '*', are used, a single or double quotes must be used
如果这些字符中的任何一个,'>'、'<'、'|' 或 '*',必须使用单引号或双引号
conda install [-y] package">=version"
conda install [-y] package'>=low_version, <=high_version'
conda install [-y] "package>=low_version, <high_version"
conda install -y torchvision">=0.3.0"
conda install openpyxl'>=2.4.10,<=2.6.0'
conda install "openpyxl>=2.4.10,<3.0.0"
where option -y, --yes Do not ask for confirmation.
where option -y, --yes 不要求确认。
Here is a summary:
这是一个总结:
Format Sample Specification Results
Exact qtconsole==4.5.1 4.5.1
Fuzzy qtconsole=4.5 4.5.0, 4.5.1, ..., etc.
>=, >, <, <= "qtconsole>=4.5" 4.5.0 or higher
qtconsole"<4.6" less than 4.6.0
OR "qtconsole=4.5.1|4.5.2" 4.5.1, 4.5.2
AND "qtconsole>=4.3.1,<4.6" 4.3.1 or higher but less than 4.6.0
Tested on conda 4.7.12
在 conda 4.7.12 上测试

