tlbakh
tlbakh

Reputation: 71

can't install MySQL-Python

I wanted to try sqlalchemy for my code but in order to use it I need first to install mysql-python. I downloaded the package but when I tried {python setup.py install} it gives me an error that I cannot understand.

running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-i686-2.7/MySQLdb
running build_ext
building '_mysql' extension
i686-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,4,'beta',4) -D__version__=1.2.4b4 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-i686-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 'i686-linux-gnu-gcc' failed with exit status 1

after sudo apt-get install python2.7-dev

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
python2.7-dev : Depends: libpython2.7-dev (= 2.7.4-2ubuntu3.2) but it is not     going to be installed
             Depends: libexpat1-dev but it is not installable
E: Unable to correct problems, you have held broken packages.

Upvotes: 3

Views: 6567

Answers (3)

Pranav Nandan
Pranav Nandan

Reputation: 361

If it is for python 3.6, you have to install corresponding python3-dev, i.e:

sudo apt-get install python3.6-dev

Upvotes: 9

Sachin Singh
Sachin Singh

Reputation: 7225

try this out:

sudo apt-get install zlib1g-dev

Upvotes: -1

David de Kleer
David de Kleer

Reputation: 116

You probably haven't installed python-dev, so I would suggest you to run

sudo apt-get install python-dev

Source: Python.h missing from Ubuntu 12.04

Upvotes: 3

Related Questions