3

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.

3 Answers 3

9

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

sudo apt-get install python3.6-dev
Sign up to request clarification or add additional context in comments.

Comments

3

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

11 Comments

Actually, I already tried. This is the error it gave. Reading package lists... Done Building dependency tree Reading state information... Done Package python-dev is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: python E: Package 'python-dev' has no installation candidate
Hmm, that's a bit strange... Can you try looking up python-dev in Synaptic and install it from there?
If I didn't do something wrong, synaptic says python2.7-dev is broken. That's weird.
Agreed, I don't really know what's the cause of that :-( Unmet dependencies or something? What if you try sudo apt-get install python2.7-dev?
Wow! The error I got doesn't look good. What should I do? Added it to question.
|
-1

try this out:

sudo apt-get install zlib1g-dev

1 Comment

What does this lib do? And why would it solve the problem?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.