After running pip3 install mysqlclient, the following error occurs:
ERROR: Command errored out with exit status 1: command: /usr/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hmicg9lo/mysqlclient_17bc9786b14e4bff9a8bdcf2c8427558/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hmicg9lo/mysqlclient_17bc9786b14e4bff9a8bdcf2c8427558/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-o3rs50h8/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6/mysqlclient cwd: /tmp/pip-install-hmicg9lo/mysqlclient_17bc9786b14e4bff9a8bdcf2c8427558/ Complete output (46 lines): mysql_config --version ['5.7.33'] mysql_config --libs ['-L/usr/lib/x86_64-linux-gnu', '-lmysqlclient', '-lpthread', '-lz', '-lm', '-lrt', '-lssl', '-lcrypto', '-ldl'] mysql_config --cflags ['-I/usr/include/mysql'] ext_options: library_dirs: ['/usr/lib/x86_64-linux-gnu'] libraries: ['mysqlclient', 'pthread', 'm', 'rt', 'dl'] extra_compile_args: ['-std=c99'] extra_link_args: [] include_dirs: ['/usr/include/mysql'] extra_objects: [] define_macros: [('version_info', "(2,1,0,'final',0)"), ('__version__', '2.1.0')] /usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type' warnings.warn(msg) /usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'python_requires' 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/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=(2,1,0,'final',0) -D__version__=2.1.0 -I/usr/include/mysql -I/usr/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.linux-x86_64-3.6/MySQLdb/_mysql.o -std=c99 MySQLdb/_mysql.c:46:20: fatal error: Python.h: No such file or directory compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ---------------------------------------- ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-hmicg9lo/mysqlclient_17bc9786b14e4bff9a8bdcf2c8427558/setup.py'"'"'; __file__='"'"'/tmp/pip-install-hmicg9lo/mysqlclient_17bc9786b14e4bff9a8bdcf2c8427558/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-o3rs50h8/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6/mysqlclient Check the logs for full command output.
Solution:
sudo apt-get install python3.6-dev
It may be due to the mismatch of dev version due to the installation of Python 3.6 in Ubuntu.
Read More:
- How to Solve labelme Install Error in Ubuntu
- How to Solve Xmind Install Error in Ubuntu System
- How to Solve Mujoco Install Error in Ubuntu (Pycharm Run Error)
- Ubuntu Server: How to Install Chrome
- Ubuntu20.04 install the ROS noetic version in catkin_Problems in make compilation
- How to Solve Ubuntu “Failed to fetch” Error
- Linux: How to Solve Rabbitmq Plug-in Install Error
- How to Solve Ubuntu20.04 Compile Error:error while loading shared libraries: libncurses.so.5
- [Solved] Any Softwares Install Error in Ubuntu: /usr/bin/dpkg returned an error code
- Ubuntu18.04 Install ROS Error: rosdep update [How to Solve]
- How to Uncompress 7z files on Ubuntu, Debian, Fedora
- [Solved] Ubuntu 20.04 install MATLAB and toolbox permissions Error
- How to Solve Error: Address already in use
- [Solved] Ubuntu16.4Install vcs2016 Error: mount.vboxsf: mounting failed with the error: Invalid argument
- [Solved] Ubuntu20.04 Error: “Failed to install the following Android SDK packages as some licences have not..“error
- How to Solve Rosep Problem in ROS Initialization (Sudo Rosep Init)
- How to Fix Ubuntu(Linux) mount error(22)
- Ubuntu 20.04 Desktop Install sublime-text Error: “Certificate verification failed”
- Linux Ubuntu ImportError: Libtk8.5.so: cannot open shared object file:No such file Install tkinter Library
- [Solved] Ubuntu pip Install Error: which is not on PATH