Python 如何使用 pip 安装特定版本的软件包?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13916820/
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
How to install a specific version of a package with pip?
提问by Houman
Possible Duplicate:
Installing specific package versions with Pip
可能的重复:
使用 Pip 安装特定的软件包版本
I am a bit new to pip installand virtualenvin general.
我是一个有点新的pip install和virtualenv一般的。
I have setup an virtualenv on my server as well as on my local dev environment.
我已经在我的服务器以及我的本地开发环境上设置了一个 virtualenv。
On the server the package django_modeltranslation-0.4.0_beta2works perfectly fine.
在服务器上,该软件包django_modeltranslation-0.4.0_beta2运行良好。
However on my local machine django_modeltranslation-0.5.0-alphadoesn't seem to work well at all.
但是,在我的本地机器django_modeltranslation-0.5.0-alpha上似乎根本无法正常工作。
I usually simply install it in virtual-env like this:
我通常只是将它安装在 virtual-env 中,如下所示:
$ source bin/active
(env)$ pip install django_modeltranslation
This gets the latest version though, which now for the first time causes issues working with latest version.
不过,这将获得最新版本,现在这是第一次导致使用最新版本时出现问题。
So I have uninstalled the version 5 alpha like this:
所以我已经像这样卸载了第 5 版 alpha:
(env)$ pip uninstall django_modeltranslation
But now I don't know how I could get the working version 0.4.0 Beta again. I tried this but it couldn't find it:
但现在我不知道如何才能再次获得工作版本 0.4.0 Beta。我试过这个,但找不到它:
(env)$ pip install django_modeltranslation-0.4.0_beta2
Downloading/unpacking django-modeltranslation-0.4.0-beta2
Could not find any downloads that satisfy the requirement django-modeltranslation-0.4.0-beta2
No distributions at all found for django-modeltranslation-0.4.0-beta2
I think there must be a way, since that is the whole point of using virtual env.
我认为必须有一种方法,因为这是使用虚拟环境的全部意义。
采纳答案by Martijn Pieters
Use ==:
使用==:
pip install django_modeltranslation==0.4.0-beta2

