gpt4 book ai didi

python - 无法 pip 安装 mysql-python

转载 作者:IT老高 更新时间:2023-10-28 21:14:47 27 4
gpt4 key购买 nike

我正在尝试让 django/pip/mysql 正常工作,但我似乎不知道如何安装 mysql-python。这是我在尝试安装 mysql-python 时收到的错误

pip install mysql-pythonDownloading/unpacking mysql-python  Downloading MySQL-python-1.2.4.zip (113kB): 113kB downloaded  Running setup.py egg_info for package mysql-python    Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz    Extracting in /tmp/tmp5jjdpf    Now working in /tmp/tmp5jjdpf/distribute-0.6.28    Building a Distribute egg in /home/brian/flaskapp/build/mysql-python    /home/brian/flaskapp/build/mysql-python/distribute-0.6.28-py2.7.eggInstalling collected packages: mysql-python  Running setup.py install for mysql-python    building '_mysql' extension    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,4,'final',1) -D__version__=1.2.4 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG    _mysql.c:29:20: fatal error: Python.h: No such file or directory    compilation terminated.    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1    Complete output from command /home/brian/flaskapp/bin/python -c "import setuptools;__file__='/home/brian/flaskapp/build/mysql-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Ur7r16-record/install-record.txt --single-version-externally-managed --install-headers /home/brian/flaskapp/include/site/python2.7:    running installrunning buildrunning build_pycreating buildcreating build/lib.linux-x86_64-2.7copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7creating build/lib.linux-x86_64-2.7/MySQLdbcopying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdbcopying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdbcopying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdbcopying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdbcopying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdbcopying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdbcreating build/lib.linux-x86_64-2.7/MySQLdb/constantscopying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constantscopying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constantscopying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constantscopying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constantscopying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constantscopying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constantscopying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constantsrunning build_extbuilding '_mysql' extensioncreating build/temp.linux-x86_64-2.7x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,4,'final',1) -D__version__=1.2.4 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG_mysql.c:29:20: fatal error: Python.h: No such file or directorycompilation terminated.error: command 'x86_64-linux-gnu-gcc' failed with exit status 1----------------------------------------Cleaning up...Command /home/brian/flaskapp/bin/python -c "import setuptools;__file__='/home/brian/flaskapp/build/mysql-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Ur7r16-record/install-record.txt --single-version-externally-managed --install-headers /home/brian/flaskapp/include/site/python2.7 failed with error code 1 in /home/brian/flaskapp/build/mysql-pythonStoring complete log in /home/brian/.pip/pip.log

Googling reveals i need to install python-dev but whenever i try to install with

sudo apt-get install python-dev

我得到这个错误:

E: Package 'python-dev' has no installation candidate

我目前正在使用 linux mint 15 RC,我认为这可能是问题...但我不确定。我没有想法:(

最佳答案

尝试通过软件管理器下载python-dev:

sudo apt-get install python-dev

关于python - 无法 pip 安装 mysql-python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18564745/

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