2014-01-30 89 views
2

我在Ubuntu上安裝了Python 2.7,Django 1.5.5,MySQL 5.5。然後我試圖安裝SQL驅動程序的Python:Python 2.7 + Django + MySQL-python錯誤

sudo pip install MySQL-python 

,結果是

Downloading/unpacking MySQL-python 
Cannot fetch index base URL https://pypi.python.org/simple/ 
Could not find any downloads that satisfy the requirement MySQL-python 
Cleaning up... 
No distributions at all found for MySQL-python 
Storing debug log for failure in .pip/pip.log 

可能是什麼問題呢?

我想: 須藤的easy_install的MySQL-python的

與結果:

> Searching for MySQL-python Reading 
> http://pypi.python.org/simple/MySQL-python/ Download error on 
> http://pypi.python.org/simple/MySQL-python/: [Errno -3] Temporary  
> failure in name resolution -- Some packages may not be found! Reading 
> http://pypi.python.org/simple/MySQL-python/ Download error on 
> http://pypi.python.org/simple/MySQL-python/: [Errno -3] Temporary 
> failure in name resolution -- Some packages may not be found! Couldn't 
> find index page for 'MySQL-python' (maybe misspelled?) Scanning index 
> of all packages (this may take a while) Reading 
> http://pypi.python.org/simple/ Download error on 
> http://pypi.python.org/simple/: [Errno -3] Temporary failure in name 
> resolution -- Some packages may not be found! No local packages or 
> download links found for MySQL-python error: Could not find suitable 
> distribution for Requirement.parse('MySQL-python') 
+0

你有沒有嘗試過 「的easy_install的MySQL-python的」? (如果你沒有安裝python dev,你需要執行「apt-get install python-dev」) – AlvaroAV

+0

看起來像包名稱解析中的問題,並且我以什麼方式執行操作並不重要。 – ph7

回答

1

正確的命令是:

sudo ap-get install python-mysqldb 
+0

'sudo apt-get install python-mysqldb'只在清理後才起作用。首先,我將.deb軟件包從存儲庫下載到本地磁盤(其他存儲庫不是我的默認存儲庫),而不是安裝它。後來我做了'sudo apt-get remove。/ python-mysqldb_1.2.3-1build1_i386.deb'。此清理工作原因不明。最後,'sudo apt-get install python-mysqldb'工作。 – ph7

+1

@ ph7:那麼你現在應該可以'pip安裝MySQL-python' – hellsgate