mysql - Python 2.7 + Django + MySQL-python错误

标签 mysql django python-2.7 pip mysql-python

我在 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')

最佳答案

正确的命令是:

sudo ap-get install python-mysqldb

关于mysql - Python 2.7 + Django + MySQL-python错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21453009/

相关文章:

c# - mySQL .NET API - 从表中删除所有数据

python - “MySQL 服务器已经消失”,进程持久

php - 根据日期自动执行操作。 PHP/MySQL

python - django 模型中使用 HTML 装饰字段

python - 反编译 Python 2.7 .pyc

php - 功能中的第二个选择查询不起作用

python - 在带有 tinymce 的 Django admin 中使用富文本编辑器

python - 如何覆盖 django.contrib.gis

python-2.7 - 带有强制前导零的python科学记数法

python - Python 中的 100 个项目 - 反向字符串替代答案