如何在 virtualenv 上安装旧版本的 Django?
我想在虚拟环境中安装某个特定版本的包(在本例中为 Django)。我想不通。
我使用的是 Windows XP,并且我成功创建了虚拟环境,并且能够运行它,但是我应该如何在其中安装我想要的 Django 版本呢?我的意思是,我知道使用新创建的 easy_install
脚本,但是如何让它安装 Django 1.0.7?如果我执行 easy_install django
,它将安装最新版本。我尝试以各种方式将版本号 1.0.7 放入此命令中,但没有任何效果。
我该怎么做?
I want to install some specific version of a package (in this case Django) inside the virtual environment. I can't figure it out.
I'm on Windows XP, and I created the virtual environment successfully, and I'm able to run it, but how am I supposed to install the Django version I want into it? I mean, I know to use the newly-created easy_install
script, but how do I make it install Django 1.0.7? If I do easy_install django
, it will install the latest version. I tried putting the version number 1.0.7
into this command in various ways, but nothing worked.
How do I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
从来没有 Django 1.0.7。 1.0系列只到了1.0.4。您可以在Django 代码存储库的标签部分中查看所有版本。
但是,要回答您的问题,请不要使用
easy_install
,而使用pip
。 (如果尚未安装,请执行easy_install pip
,然后不要再碰 easy_install)。现在你可以这样做:There was never a Django 1.0.7. The 1.0 series only went up to 1.0.4. You can see all the releases in the tags section of the Django code repository.
However to answer your question, don't use
easy_install
, usepip
. (If it's not already installed, doeasy_install pip
, then never touch easy_install again). Now you can do:对上一位发帖者的回复+1:如果可以的话,使用
pip
。但是,在紧要关头,最简单的方法是安装旧版本,从 downloads< 下载 tarball /a> 页面,或者,如果您安装了 subversion,请对您想要的版本进行 svn 导出(它们都标记为 此处)。一旦您拥有所需的 Django 版本,只需在 django 目录中运行以下命令:
这将在您的 virtualenv 中安装该版本的 Django。
+1 on the previous poster's reply: use
pip
if you can. But, in a pinch, the easiest way is to install an older version would be to download the tarball from the downloads page or, if you have subversion installed, do ansvn export
of the release you want (they are all tagged here).Once you have the version of Django you want, just run the following command inside the django directory:
This will install that version of Django in your virtualenv.
对于已经提到的解决方案+1。
我只是想添加另一个解决方案。
要安装 Django 的特定版本(例如 1.10.x),
从 Github。
git clone https://github.com/django/django.git
进入目录并签出到特定分支。
cd django
git checkout origin/stable/1.10.x
运行安装命令。
python setup.py install
+1 for already mentioned solutions.
I just wanna add another solution.
To install a specific version of Django (say 1.10.x),
Clone the Django repo from Github.
git clone https://github.com/django/django.git
Go into the directory and checkout to the specific branch.
cd django
git checkout origin/stable/1.10.x
Run install command.
python setup.py install
pip install "django>=2.2,<3"
安装 djnago 2.2
pip install "django>=2.2,<3"
To install djnago 2.2
这将允许您安装所需的版本,我在操作系统:Windows10 上尝试过,它完美地工作了。
This will allow you to install the desired version, and I tried on OS:Windows10 and it perfectly worked.