我正在尝试使用 pip
安装 django 版本 1.3.3。我有 1.5.1 版本,所以我卸载了它并运行了这个命令
sudo pip install django==1.3.3
当我运行它时,我得到了这个响应
$ sudo pip install django==1.3.3
Downloading/unpacking django==1.3.3
Running setup.py egg_info for package django
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
Requested django==1.3.3, but installing version 1.5.1
Installing collected packages: django
Running setup.py install for django
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
changing mode of /usr/local/bin/django-admin.py to 755
Successfully installed django
Cleaning up...
它告诉我它有 pip 令人沮丧,它知道我想要 1.3.3.... 但无论如何它都会为我安装 1.5。我怎么才能告诉它我真的想要 1.3.3?
最佳答案
首先清理你的缓存中任何看起来像 Django 的东西:
~/.pip
~/tmp
或者放置一个“干净”的地方来安装它以使用--download-cache
选项
对于不同的版本使用 virtualenv
安装。作为sudo pip install
全局安装
您使用的是什么版本的 pip?这should have been fixed pip >=1.4(当前最新的)。根据您从何处获取软件包,它可能会在将来帮助您从源代码重新安装 pip/build。
我知道目前在 Debian 上我的配置只能安装:
python-pip | 1.1-3 | http://ftp.us.debian.org/debian/ wheezy/main Sources
如您所见,不包括 1.4
.
生成版本号的相关命令是apt-cache madison <package>
,是的 madison
实际上是参数的名称。
顺便说一句,在我的版本 (1.3) 上 pip install -i 是:
-i URL, --index-url=URL, --pypi-url=URL
Base URL of Python Package Index (default
http://pypi.python.org/simple/)
这不是 ignore
, 虽然有
-I, --ignore-installed
Ignore the installed packages (reinstalling instead)
但在你的情况下,由于 django 的全局安装,这可能会把事情搞得一团糟
关于python - 安装旧版本的 Django,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17927270/