简体   繁体   中英

Error Installing mysqlclient on Ubuntu 16.04 using pip and Python 3.6

I am getting a strange error when trying to install mysqlclient on Ubuntu 16.04 Xenial with pip + Python 3.6 :

 pip install mysqlclient

Output:

 _mysql.c:40:20: fatal error: Python.h: No such file or directory
 compilation terminated.
 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Following the installation requirements , I have tried installing the required libraries, but not luck so far.

sudo apt-get install python3-dev libmysqlclient-dev

Does someone know the workaround for this issue?

I am getting a strange error when trying to install mysqlclient on Ubuntu 16.04 Xenial with pip + Python 3.6 :

 pip install mysqlclient

Output:

 _mysql.c:40:20: fatal error: Python.h: No such file or directory
 compilation terminated.
 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Following the installation requirements , I have tried installing the required libraries, but not luck so far.

sudo apt-get install python3-dev libmysqlclient-dev

Does someone know the workaround for this issue?

I am getting a strange error when trying to install mysqlclient on Ubuntu 16.04 Xenial with pip + Python 3.6 :

 pip install mysqlclient

Output:

 _mysql.c:40:20: fatal error: Python.h: No such file or directory
 compilation terminated.
 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Following the installation requirements , I have tried installing the required libraries, but not luck so far.

sudo apt-get install python3-dev libmysqlclient-dev

Does someone know the workaround for this issue?

I am getting a strange error when trying to install mysqlclient on Ubuntu 16.04 Xenial with pip + Python 3.6 :

 pip install mysqlclient

Output:

 _mysql.c:40:20: fatal error: Python.h: No such file or directory
 compilation terminated.
 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Following the installation requirements , I have tried installing the required libraries, but not luck so far.

sudo apt-get install python3-dev libmysqlclient-dev

Does someone know the workaround for this issue?

I am getting a strange error when trying to install mysqlclient on Ubuntu 16.04 Xenial with pip + Python 3.6 :

 pip install mysqlclient

Output:

 _mysql.c:40:20: fatal error: Python.h: No such file or directory
 compilation terminated.
 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Following the installation requirements , I have tried installing the required libraries, but not luck so far.

sudo apt-get install python3-dev libmysqlclient-dev

Does someone know the workaround for this issue?

Even though I'm late, I'd like to address a few things while answering your question.

Some suggests to install python3-dev, some suggests libmysqlclient-dev etc. But they might already have installed some of the packages thats required while installing and only installing the mentioned package made it work for them. However, it might not be the case with everyone.

You can refer to the mysqlclient's official documentation and scroll down to installation instructions for Linux - mysqlclient

Generally, these are the packages required before you can mysqlclient

sudo apt-get install python3-dev default-libmysqlclient-dev build-essential

Now, since you mentioned you ran this.

sudo apt-get install python3-dev libmysqlclient-dev

Looking at the documentation, you are missing these packages.

  • default-libmysqlclient-dev
  • build-essential

So, the answer for your question is

sudo apt-get install default-libmysqlclient-dev build-essential

And then you shoud install mysqlclient

pip install mysqlclient

Hope that answers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM