2013-09-02 88 views
14

Tôi đang cố gắng để có được django/pip/mysql làm việc và tôi dường như không thể tìm ra cách cài đặt mysql-python. đây là lỗi tôi nhận được khi cố gắng cài đặt mysql-pythonkhông thể pip cài đặt mysql-python

 
pip install mysql-python 

Downloading/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.egg 

Installing 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 install 

running build 

running build_py 

creating build 

creating build/lib.linux-x86_64-2.7 

copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7 

creating build/lib.linux-x86_64-2.7/MySQLdb 

copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb 

copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb 

copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb 

copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb 

copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb 

copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb 

creating build/lib.linux-x86_64-2.7/MySQLdb/constants 

copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants 

copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants 

copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants 

copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants 

copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants 

copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants 

copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants 

running build_ext 

building '_mysql' extension 

creating build/temp.linux-x86_64-2.7 

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 

---------------------------------------- 
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-python 
Storing complete log in /home/brian/.pip/pip.log 

Googling thấy tôi cần phải cài đặt python-dev nhưng bất cứ khi nào tôi cố gắng để cài đặt với

sudo apt-get install python-dev 

tôi nhận được lỗi này:

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

Tôi hiện đang sử dụng linux mint 15 RC và tôi nghĩ rằng đó có thể là vấn đề ... nhưng tôi không chắc chắn. tôi ra khỏi ý tưởng :(

+0

Tôi tìm thấy điều này trong một diễn đàn bạc hà ... 'sudo apt-get install python-all-dev'. Tôi không có id Mặc dù vậy, những cái tên đó được đặt trên những thứ trong bạc hà, vì vậy tôi không thể đảm bảo bất kỳ thành công nào. – mgilson

+0

$ mysql_config Chương trình 'mysql_config' hiện chưa được cài đặt. Bạn có thể cài đặt nó bằng lệnh ở đây: sudo apt-get install libmysqlclient-dev – GrvTyagi

Trả lời

50

thử tải python-dev thông qua quản lý phần mềm:

sudo apt-get install python-dev 
0

thử

apt-get install python-mysqldb 

Làm việc đối với tôi

+0

Sẽ rất hữu ích nếu bạn cung cấp giải pháp thay vì làm việc xung quanh. –

4

ubuntu:. sudo apt-get install libmysqlclient-dev

Các vấn đề liên quan