gpt4 book ai didi

python - Django: Mysql-python 安装错误

转载 作者:太空狗 更新时间:2023-10-30 01:08:32 26 4
gpt4 key购买 nike

当尝试为 Django 安装 requirements.txt 时,我在尝试安装 Mysql-python 时收到以下错误

Traceback (most recent call last):

File "<string>", line 17, in <module>

File "/home/abercrrl/.virtualenvs/django_at/build/MySQL-python/setup.py", line 7, in <module>

use_setuptools()

File "distribute_setup.py", line 145, in use_setuptools

return _do_download(version, download_base, to_dir, download_delay)

File "distribute_setup.py", line 125, in _do_download

_build_egg(egg, tarball, to_dir)

File "distribute_setup.py", line 116, in _build_egg

raise IOError('Could not build the egg.')

IOError: Could not build the egg.

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/abercrrl/.virtualenvs/django_at/build/MySQL-python
Storing debug log for failure in /home/abercrrl/.pip/pip.log

请注意,我已经尝试过:

pip install --upgrade setuptools 

Setuptools 已经是最新的


编辑:

我修改了以下命令以匹配我的位置:

echo "mysql_config = /usr/bin/mysql_config" >> ~/.virtualenvs/django_at/build/MySQL-python/site.cfg

我确实必须创建构建和 MySQL-python 目录才能使其工作。该命令运行良好,但是现在我得到了这个: https://gist.github.com/rlabercrombie/8725074

最佳答案

您必须安装 mysql dev 和所有必需的库才能构建 mysql-python:sudo apt-get install build-essential python-dev libmysqlclient-dev python-mysqldb。详见http://mysql-python.blogspot.no/2012/11/is-mysqldb-hard-to-install.htmlhttps://stackoverflow.com/a/7461662/3219121

关于python - Django: Mysql-python 安装错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21469872/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com