2013-09-02 6 views
14

स्थापित करने में पाइप नहीं कर सकता है मैं django/pip/mysql काम करने की कोशिश कर रहा हूं और मुझे यह पता लगाना नहीं है कि mysql-python को कैसे स्थापित करें।mysql-python

: इस त्रुटि मैं प्राप्त करते हैं स्थापित करने के लिए कोशिश कर रहा mysql-अजगर

 
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 का पता चलता है मैं अजगर-देव स्थापित करने की आवश्यकता है, लेकिन जब भी मैं

sudo apt-get install python-dev 

साथ स्थापित करने का प्रयास मैं इस त्रुटि मिलती है

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

मैं वर्तमान में लिनक्स टकसाल 15 आरसी का उपयोग कर रहा हूं और मुझे लगता है कि यह समस्या हो सकती है ... लेकिन मुझे यकीन नहीं है। मैं विचारों :(

+0

मुझे यह एक टकसाल मंच में मिला ... 'sudo apt-get python-all-dev इंस्टॉल करें। मेरे पास कोई आईडी नहीं है हालांकि, मिंट में चीजों पर नाम क्या हैं, इसलिए मैं किसी भी सफलता की गारंटी नहीं दे सकता। – mgilson

+0

$ mysql_config प्रोग्राम 'mysql_config' वर्तमान में स्थापित नहीं है। आप इसे यहां कमांड द्वारा इंस्टॉल कर सकते हैं: sudo apt-get libmysqlclient-dev – GrvTyagi

उत्तर

50

सॉफ्टवेयर प्रबंधक के माध्यम से कोशिश डाउनलोड अजगर-देव के बाहर हूँ:

sudo apt-get install python-dev 
0

कोशिश

apt-get install python-mysqldb 

मेरे लिए काम किया

+0

इंस्टॉल करें यदि आप आसपास के काम के बजाय समाधान प्रदान करते हैं तो यह सहायक होगा। –

4

ubuntu:। sudo apt-get install libmysqlclient-dev