【问题标题】:Python 2.7 + Django + MySQL-python errorPython 2.7 + Django + MySQL-python 错误
【发布时间】:2014-02-22 13:12:34
【问题描述】:

我在 Ubuntu 上安装了 Python 2.7、Django 1.5.5、MySQL 5.5。然后我尝试为 python 安装 SQL 驱动程序:

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

可能是什么问题?

我试过了: sudo 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')

【问题讨论】:

  • 你试过“easy_install MySQL-python”吗? (如果你没有安装python dev,你需要做“apt-get install python-dev”)
  • 看起来包名解析有问题,我怎么做都没关系。

标签: mysql django python-2.7 pip mysql-python


【解决方案1】:

正确的命令是:

sudo ap-get install python-mysqldb

【讨论】:

  • 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:那你现在应该可以pip install MySQL-python
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-07-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-07-25
相关资源
最近更新 更多