I installed Python 2.7.15rci and Python 3.6.7 on Ubuntu. When i did 'pip list' on virtualenv it returns me:
Django (2.1.5)
pip (9.0.1)
pkg-resources (0.0.0)
pytz (2018.9)
setuptools (39.0.1)
wheel (0.32.3)
I'm trying to install mysqlclient (pip install mysqlclient) and returns an error.
unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for mysqlclient
Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command /home/david/env/project/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pq18uxjj/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-y28h4ou0-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/david/env/project/include/site/python3.6/mysqlclient:
/usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.6/MySQLdb
creating build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/MySQLdb
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,4,1,'final',0) -D__version__=1.4.1 -I/usr/include/mysql -I/home/david/env/project/include -I/usr/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o
unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/david/env/project/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pq18uxjj/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-y28h4ou0-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/david/env/project/include/site/python3.6/mysqlclient" failed with error code 1 in /tmp/pip-build-pq18uxjj/mysqlclient/
So, I have tried different methods found like:
sudo apt-get install python-dev
sudo apt-get install python3-dev
sudo apt-get install libmysqlclient-dev
and some more... but none of them work for me and the problem persists.
Any suggestions?
Thank you!
gcc is part of the build-essential package, which you should install before anything else:
sudo apt-get install build-essential
UPDATE: Following #bosnjak's suggestion, you also might need to install the openssl developer tools:
sudo apt-get install libssl-dev
I specified the particular version of python it's 3.7
And that helped me
I have installed these ones:
sudo apt-get install python3.7-dev libmysqlclient-dev
And then installed mysqlclient by:
pip install mysqlclient
I turned out, that the solution is slightly different for almost every Python version. For those using different versions, such as Python 2.x, 3.5 or 3.7 I found this:
Part I
For Python 2.x use:
$ sudo apt-get install python-dev
For Python 2.7 use:
$ sudo apt-get install libffi-dev
For Python 3.x use:
$ sudo apt-get install python3-dev
For Python 3.4 use:
$ sudo apt-get install python3.4-dev
For Python 3.7 use:
$ sudo apt-get install python3.7-dev
For Python 3.8 use:
$ sudo apt-get install python3.8-dev
For Python 3.9 use:
$ sudo apt-get install python3.9-dev
Part II
If this still doesn't help, others have pointed out to install
$ sudo apt-get install build-essential
and finally
$ sudo apt-get install libssl-dev
But the last two didn't help myself - but hoping this might help you!
You may do this before:
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
Source: https://pypi.org/project/mysqlclient/
This issue was persistent in Ubuntu and python 3+. In my case, I was using Ubuntu 18.04 and found this solution to be useful for python version 3.7.5
Step 1. Install libpython3.7-dev via sudo apt
> sudo apt-get install libpython3.7-dev
Step 2: Install mysqlclient
> python3 -m pip install mysqlclient==1.4.6
I wanted to install the 'Modoboa' mail-server package (https://github.com/modoboa/modoboa) on my Ubuntu 18.04 with Apache as my webserver, instead of nginx. I needed mysqlclient for Python 2.7. The following packages worked for me:
sudo apt-get install libssl-dev gcc python2.7-dev libmysqlclient-dev
I'm using the python3.8. Similarly to david's answer, use the following command then it works.
$ sudo apt-get install python3.8-dev
Related
I'm working on Mac Catalina with Pyenv with the goal to install apache-airflow[all]. I'm failing and specifically with apache-airflow[mysql]
here is my recipe:
pyenv virtualenv 3.7.4 test
pyenv activate test
pip install --upgrade pip
pip install Cython
pip install 'apache-airflow[mysql]'
pip install 'apache-airflow[all]'
I've tried lots of different stack overflow remedies to install apache-airflow[mysql] including
brew upgrade mysql
brew install mysql-connector-c
How do I install MYSQL client?
How do I install the complete apache airflow on the virtualenv?
here is the error using pyenv virtualenv
(tst) ➜ ~ python -V
Python 3.7.4
(tst) ➜ ~ pip install mysqlclient
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
ERROR: Command errored out with exit status 1:
command: /Users/gideonbar/.pyenv/versions/3.7.4/envs/tst/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/t_/ccp4hjg92rzbpjrc4d3cnpm00000gn/T/pip-install-dy9_xr4y/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/t_/ccp4hjg92rzbpjrc4d3cnpm00000gn/T/pip-install-dy9_xr4y/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/t_/ccp4hjg92rzbpjrc4d3cnpm00000gn/T/pip-record-pdn28c7j/install-record.txt --single-version-externally-managed --compile --install-headers /Users/gideonbar/.pyenv/versions/3.7.4/envs/tst/include/site/python3.7/mysqlclient
cwd: /private/var/folders/t_/ccp4hjg92rzbpjrc4d3cnpm00000gn/T/pip-install-dy9_xr4y/mysqlclient/
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-3.7
creating build/lib.macosx-10.15-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.15-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.macosx-10.15-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.15-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.15-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.15-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.15-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.15-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.15-x86_64-3.7/MySQLdb
creating build/lib.macosx-10.15-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.15-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.15-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.15-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.15-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.15-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.15-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.macosx-10.15-x86_64-3.7
creating build/temp.macosx-10.15-x86_64-3.7/MySQLdb
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 -I/usr/local/Cellar/mysql/8.0.18_1/include/mysql -I/Users/gideonbar/.pyenv/versions/3.7.4/envs/tst/include -I/Users/gideonbar/.pyenv/versions/3.7.4/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.macosx-10.15-x86_64-3.7/MySQLdb/_mysql.o
clang -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/gideonbar/.pyenv/versions/3.7.4/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/gideonbar/.pyenv/versions/3.7.4/lib build/temp.macosx-10.15-x86_64-3.7/MySQLdb/_mysql.o -L/usr/local/Cellar/mysql/8.0.18_1/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.15-x86_64-3.7/MySQLdb/_mysql.cpython-37m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/gideonbar/.pyenv/versions/3.7.4/envs/tst/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/t_/ccp4hjg92rzbpjrc4d3cnpm00000gn/T/pip-install-dy9_xr4y/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/t_/ccp4hjg92rzbpjrc4d3cnpm00000gn/T/pip-install-dy9_xr4y/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/t_/ccp4hjg92rzbpjrc4d3cnpm00000gn/T/pip-record-pdn28c7j/install-record.txt --single-version-externally-managed --compile --install-headers /Users/gideonbar/.pyenv/versions/3.7.4/envs/tst/include/site/python3.7/mysqlclient Check the logs for full command output.
(tst) ➜ ~
I tried following this link
https://github.com/JudgeGirl/Judge-sender/issues/4
brew install mysql # install mysql
brew unlink mysql
brew install mysql-connector-c
# in ~/.zshrc update path and set the mysql bin folder to path
MYSQL_VER=8.0.18_1
export PATH=/usr/local/Cellar/mysql/$MYSQL_VER/bin:$PATH
sudo ln -s /usr/local/Cellar/mysql/$MYSQL_VER/lib/libmysqlclient.21.dylib /usr/local/Cellar/mysql-client/8.0.18/lib/libmysqlclient.21.dylib # create symlink
in terminal:
pyenv activate tst
pip install mysqlclient # install mysql-client finally
If you are getting following error while installing airflow in mac
Invalid active developer path error after upgrading to El Capitan
Try following to fix the dependency
xcode-select --install
To install apache airflow
pip install apache-airflow
Error:
raise AttributeError("Could not find PyAudio; check installation")
AttributeError: Could not find PyAudio; check installation
I tried all of these commands:
sudo pip install pyaudio,
sudo apt-get install python-pyaudio ,
sudo pip install pyaudio ,
sudo pip install --upgrade pyaudio.
First, undo what you have done.
Then try to install it following their documentation for Debian based versions:
$ sudo apt install portaudio19-dev python-all-dev
followed by
$ sudo apt install python-pyaudio for python 2 version
OR
$ sudo apt install python-pyaudio for python 3 version.
I am trying to install the Elastic Beanstalk CLI (awsebcli) on a fresh Ubuntu 14.04 (on Linux subsystem for Windows) using sudo pip install awsebcli, but launching the eb command just returns the following error:
flavien#XPS-FLAVIEN:~$ eb
Traceback (most recent call last):
File "/usr/local/bin/eb", line 6, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3036, in <module>
#_call_aside
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3020, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3049, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 654, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 968, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 854, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'termcolor==1.1.0' distribution was not found and is required by awsebcli
Any idea what might be going wrong?
You can reinstall awsebcli with below command if you have issues after installing it:
sudo pip3 install awsebcli --force-reinstall --upgrade
Once its installed check where its installed:
which eb
$ /usr/local/bin/eb #i got eb installed in this path
Next set the path:
export PATH=/usr/local/bin:$PATH
Then run
eb --version
EB CLI 3.14.6 (Python 3.5.2) #this is my installed version
First install the pip separably and try with this command
pip install --upgrade --user awsebcli
I had awsebcli being installed for Python 2.7 but for some reason running eb needed them for Python 3.x so doing this worked :
$ sudo -H pip3 install --upgrade --user awsebcli
After installing all the required wheels eb worked fine :
$ eb --version
EB CLI 3.14.3 (Python 3.5.2)
Also don't forget to add ~/.local/bin to your PATH variable in ~/.bash_profile
The previous answer helped me to figure this one out.
My detail, I had to install a newer version of python than 2.7, one that supported the --trusted-host switch to allow me to get all of my dependencies:
What I ran:
pip --cert zxroot.pem --trusted-host pypi.python.org --proxy [ProxyServer] install --upgrade --user awsebcli
Once I ran that reinstall using the --upgrade switch, eb finally worked:
eb --version
EB CLI 3.10.5 (Python 3.3.1)
I know this is very specific to my particulars but it might help someone else.
Good luck.
The problem is you are missing quite a few applications required by the scripts to compile.
The following installation steps are required prior to running the EB CLI scripts.
As I'm a windows user I created a clean VirtualBox VM install of Ubuntu 18.04.2
Update Ubuntu
sudo apt update
sudo apt upgrade
sudo reboot
Install curl,wget
sudo apt install curl
sudo apt install wget
Install zlib
sudo apt-get install zlib1g-dev
Install libffi
sudo apt-get install libffi libffi5-dev
Install OpenSSL
sudo apt-get install libssl-dev
Install gcc
sudo apt-get install build-essential
sudo apt install libx11-dev
gcc --version
make -v
Install Python 3.7
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.7
python3.7 --version
alias python='python3.7'
Install Git
sudo apt install git
After this run the EB CLI
You should see these 5 successful progress steps
Creating exclusive virtualenv for EBCLI
Activating virtualenv
Installing EBCLI
Creating EB wrappers
Finishing up
Success!
Try This:
sudo chown -R username:username ~/.local/
# add to ./*shrc
export PATH=$PATH:~/.local/bin/
pip install --upgrade --user awsebcli
eb --version
#EB CLI 3.10.1 (Python 2.7.1)
I installed django 1.8.5 in virtualenv and using python 3.4.3
the worked displayed the it works page when using sqlite
I wanted to use mysql and I'm trying to install mysqlclient using
pip install mysqlclient
and I'm getting the following message
----------------------------------------
Failed building wheel for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient
Complete output from command /home/sasidhar/django/env/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-5lj39q67/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-da2_35zs-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/sasidhar/django/env/include/site/python3.4/mysqlclient:
running install
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.4/MySQLdb
running build_ext
building '_mysql' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,3,6,'final',1) -D__version__=1.3.6 -I/usr/include/mysql -I/usr/include/python3.4m -I/home/sasidhar/django/env/include/python3.4m -c _mysql.c -o build/temp.linux-x86_64-3.4/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG
_mysql.c:40:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/sasidhar/django/env/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-5lj39q67/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-da2_35zs-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/sasidhar/django/env/include/site/python3.4/mysqlclient" failed with error code 1 in /tmp/pip-build-5lj39q67/mysqlclient
I did try installing libraries suggested in error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
and still the problem persists
please help me solve this problem
Thanks guys!!
You need to install python-dev:
sudo apt-get install python-dev
And, since you are using python3:
sudo apt-get install python3-dev
This command should help you.
If you are using mac os you might try:
brew update && brew rm python3 && brew install python3
You need to brew has been installed already, otherwise you can install it. It is very useful for getting packages in Mac OS. http://brew.sh/
For Ubuntu you also need to install build-essential
sudo apt-get install build-essential
For those using different versions, such as Python 3.5, 3.6 or 3.7 I found this:
Part I
For Python 2.x use:
$ sudo apt-get install python-dev
For Python 2.7 use:
$ sudo apt-get install libffi-dev
For Python 3.x use:
$ sudo apt-get install python3-dev
For Python 3.4 use:
$ sudo apt-get install python3.4-dev
For Python 3.7 use:
$ sudo apt-get install python3.7-dev
Part II
If this still doesn't help, others have pointed out to install
$ sudo apt-get install build-essential
and finally
$ sudo apt-get install libssl-dev
But the last two didn't help me personally. Just in case, hope it helps you.
For those using python3.5:
apt-get install python3.5-dev
wget https://bootstrap.pypa.io/get-pip.py
python3.5 get-pip.py
pip3.5 install mysqlclient
Tried all of the above suggestions and a few found elsewhere and nothing worked. In the end the solution was simple enough (courtesy of ignacionf on GitHub):
pip install git+https://github.com/PyMySQL/mysqlclient-python.git
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.
If it is for python 3.6, you have to install corresponding python3-dev, i.e:
sudo apt-get install python3.6-dev
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
try this out:
sudo apt-get install zlib1g-dev