2013-07-29 95 views
3

我試圖用pip安裝django 1.3.3版本。我有1.5.1版,所以我卸載它,跑這條命令安裝老版本的Django

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... 

它有點不安,它告訴我,它知道我想要1.3.3 ....但是無論如何它會爲我安裝1.5。我怎麼能告訴它我真的想要1.3.3?

+0

你可能已經安裝了1.5之前的版本。我會推薦使用virtualenv。如果沒有,刪除Django的所有可用的安裝和重新安裝 – karthikr

+0

我已經安裝了1.5,所以我跑'PIP卸載django' – Hoopdady

+0

嘗試手動刪除它,可能會卸載失敗 – karthikr

回答

2

先清理任何東西緩存看起來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>,yup madison實際上是參數的名稱。

通過對我的版本(1.3)的方式安裝PIP -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的全球安裝

相關: pip install: How to force a specific package version

+0

我讀過,我需要清除舊版本,但找不到它們。只是爲了踢我再檢查一次,並在那裏他們在/ tmp目錄。謝謝。 – Hoopdady

+0

沒問題:)祝你好運! –