Trusted answers to developer questions
Trusted Answers to Developer Questions
Related Tags
python
django
communitycreator
NDUKWE CHIDERA K.
Take a Free Course
Great engineers are always investing in themselves. Upskill yourself today.
To successfully use Python to communicate to any database, you need to have the Python database client for that database.
When you develop Django web applications and start a project successfully, the project is shipped with the sqlite database and its settings for your use. If you want to use a different database, such as MySql, you have to make changes in the settings file and make sure you install the database client for that database.
Note: You can follow this link to learn how to successfully start a Django project.
What is mysqlclient?
This is a database client application that serves as the medium/interface between the userthe client running Python codes and the mysql database. mysqlclient was developed to replace MySql-python and provides support for Python3, although it is backward compatible as well.
How to use mySqlclient
To use this service, you have to install it through the Python package installer pip, as shown below:
pip install mysqlclient
This command will automatically download and install the mysqlclient package into your device. However, this process is not always problem-free due to some reasons, like pip trying to install the latest version that might not match properly with your system.
If a problem arises, pip will throw an error with a message like mysqliclient installation error.
How to fix this problem
- First, check that you are connected to the internet and it is stable. Try to run the command again.
- Next, you will have to manually download and install the package if the problem persists. To do this, you can Google the binary file of
mysqlclientthat is compatible with your device, or you can go to this site. Please note that this website is not officially owned by the owners ofmysqland is more like a support/community forum. - Now, after a successful download, you can move the package to the parent directory where your Django project is located, or you can place it anywhere you wish. Go to your command prompt or terminal and use the command below:
cd/to/my/directory/path/to_mysqlclient.exe/file pip install mysqlclient
If I place the package in my Django app parent directory, my command will look something like this:
C:Usersmydevicecodesdjangoapps pip install mysqlclient‑1.4.6‑cp39‑cp39‑win32.whl
You don’t need to type the whole name when you enter the directory that contains the file. Just enter the first few letters of the file’s name and hit the
tabkey to complete the name.
After that, hit enter to install the package. mysqlclient should install successfully now.
RELATED TAGS
python
django
communitycreator
CONTRIBUTOR
NDUKWE CHIDERA K.
Take a Free Course
Great engineers are always investing in themselves. Upskill yourself today.
Learn in-demand tech skills in half the time
Copyright ©2023 Educative, Inc. All rights reserved.
-
#1
I’m trying to set up a Python application using the cPanel interface. I’ve successfully created it and added the requirements.txt file.
But when I click the «Run Pip Install» button, and select «requirements.txt», after it spins for a while I get this error message:
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> See above for output.note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mysqlclient
error: subprocess-exited-with-error× Running setup.py install for mysqlclient did not run successfully.
│ exit code: 1
╰─> See above for output.note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure× Encountered error while trying to install package.
╰─> mysqlclientnote: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
The requirements.txt file lists
and my Python app is set to use python 3.8.6.
How can I complete the installation?
![]()
-
#2
Hey there! cPanel doesn’t officially provide support for Python tools as outlined in our notice at the tope of this documentation page:
but have you tried making sure the mysql-community-devel or mysql-devel package is installed? If that is missing, Pip may not be able to build the mysqlclient properly.
This seems to be a relatively recent error as most information I found about this issue was created within the last 6 months. Here is one example:
-
#3
Thanks. In the end I changed from using mysqlclient to mysql-connector-python which installed OK.
A shame the former didn’t work. If I wanted to try again, how would I install the mysql-community-devel or mysql-devel packages on cPanel?
-
#4
Thanks. In the end I changed from using mysqlclient to mysql-connector-python which installed OK.
A shame the former didn’t work. If I wanted to try again, how would I install the mysql-community-devel or mysql-devel packages on cPanel?
Depends on OS but yum should work for AlmaLinux as well or you can use
dnf install [pkg-name]
yum install [pkg-name]
yum install mysql-devel
yum install mysql-community-devel
or
dnf install mysql-devel
dnf install mysql-community-devel
[[email protected] ~]# yum install mysql-community-devel
Last metadata expiration check: 1:53:02 ago on Wed 11 May 2022 11:43:10 PM CDT.
Package mysql-community-devel-8.0.29-1.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[[email protected] ~]# ]yum install mysql-devel
bash: ]yum: command not found
[[email protected] ~]# yum install mysql-devel
Last metadata expiration check: 1:54:11 ago on Wed 11 May 2022 11:43:10 PM CDT.
Package mysql-community-devel-8.0.29-1.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[[email protected] ~]
-
#5
Thank you! I’m a bit wary of installing extra stuff like this, given I’m setting this site up on someone else’s server for them. But it’s useful to know what to do if mysql-connector-python doesn’t work out (or for anyone else finding this page and wondering what to do!).
![]()
-
#6
I’m glad to hear that worked well!
Willing to solve pip install mysqlclient? It really sucks while installing in CMD because it requires up to two-three extra functions that must available.
pip is the friendly and easy way to install MySQL clients like mysqldump, which can be used for creating or restoring backup databases.
It’s also possible with this library in Python 3 run MySQL queries on localhost without any authentication required (you’ll need an administrative account).
So guys! before going further you have to understand why pip not getting installed?
What exactly problem with that it getting suck?
Let’s get started!
Contents
- 1 Fix pip install mysqlclient
- 1.1 pip install mysqlclient
- 1.2 pip install mysqlclient in Linux
- 1.3 Install directly from Github
- 2 How To Fix pip install mysqlclient

There is one command that helps to install but I do not think it will really work on every laptop or computer?
Copy out the command and run in CMD
pip install mysqlclient
If you write the above command it will return you an error so you should above from that one by the following command:
python -m pip install mysqlclient==1.4.2.post1
Stilling same? I think it is but do not worry about it. In the below-mentioned command is the latest version.
pip install mysqlclient==2.0.3
And last but not least if you are still fetching an error. I hope the latest version must help you otherwise use the following command to install mysqlclient.
pip install mysqlclient==1.3.1
Note: Keep in mind that the oldest versions are no more so, that is why you are to check out the latest version. Here
pip install mysqlclient in Linux
For Linux:
$ sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
Install directly from Github
Take a link from Github
- Copy the link.
- Paste into CMD.
- Before pasting the link write down these commands.
- python then the GitHub link which you copied and then setup.py.
- If none of the above-mentioned ideas will work anymore on your computer or laptop then download the zip file from download Github.
- Extract anywhere.
- Go to cmd.
- Do dir to check the folders, and then go to mysqlclient folder, there is one file that name is: setup.py.
- And then do cd to go to the folder.
- Run the command: python setup.py install.
- Almost done!
Read more: SyntaxError: invalid syntax when upgrading pip in Python.
How To Fix pip install mysqlclient
ERROR: Command errored out with exit status 1 mysqlclient: I was installing mysqlclient for my new Django project in my newly installed Ubuntu Linux. And after doing pip install mysqlclient, I got an error of ERROR: Command errored out with exit status 1:
(env) [email protected]:~/Projects/aeck$ pip3 install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-2.0.3.tar.gz (88 kB)
ERROR: Command errored out with exit status 1:
command: /home/codie/Projects/aeck/env/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4_d_xjb9/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4_d_xjb9/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-4_d_xjb9/mysqlclient/pip-egg-info
cwd: /tmp/pip-install-4_d_xjb9/mysqlclient/
Complete output (15 lines):
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-4_d_xjb9/mysqlclient/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-4_d_xjb9/mysqlclient/setup_posix.py", line 70, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-4_d_xjb9/mysqlclient/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Also, solve your issue for psycopg2 error install ubuntu
So, how can we fix the issue of /bin/sh: 1: mysql_config: not found or /bin/sh: 1: mariadb_config: not found.
I did some research and after digging the web for 15 minutes, I got the fix for this issue.
To fix the issue of pip install mysqlclient error, you just need to copy the below codes and execute them in your bash-shell.
Install the python3-dev package
python-dev contains the header files that the system needs to build Python extensions. It is used by lxml because it includes Python C extensions for high performance.
sudo apt-get install python3-dev
lxml is a Python C-API extension that is compiled when we run the command pip install lxml.
The lxml sources have at least something like #include <Python.h> in the code. The compiler looks for the header file Python.h during compilation, hence those header files need to be on your system such that they can be found.
Also, solve: Django MySQLClient pip compile failure on Linux
(env) [email protected]:~/Projects/aeck$ sudo apt-get install libmysqlclient-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libssl-dev libssl1.1
Suggested packages:
libssl-doc
The following NEW packages will be installed:
libmysqlclient-dev libssl-dev
The following packages will be upgraded:
libssl1.1
1 upgraded, 2 newly installed, 0 to remove and 107 not upgraded.
Need to get 4,437 kB of archives.
After this operation, 17.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libssl1.1 amd64 1.1.1f-1ubuntu2.3 [1,320 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libssl-dev amd64 1.1.1f-1ubuntu2.3 [1,582 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libmysqlclient-dev amd64 8.0.23-0ubuntu0.20.04.1 [1,536 kB]
Fetched 4,437 kB in 5s (921 kB/s)
Preconfiguring packages ...
(Reading database ... 132596 files and directories currently installed.)
Preparing to unpack .../libssl1.1_1.1.1f-1ubuntu2.3_amd64.deb ...
Unpacking libssl1.1:amd64 (1.1.1f-1ubuntu2.3) over (1.1.1f-1ubuntu2.1) ...
Selecting previously unselected package libssl-dev:amd64.
Preparing to unpack .../libssl-dev_1.1.1f-1ubuntu2.3_amd64.deb ...
Unpacking libssl-dev:amd64 (1.1.1f-1ubuntu2.3) ...
Selecting previously unselected package libmysqlclient-dev.
Preparing to unpack .../libmysqlclient-dev_8.0.23-0ubuntu0.20.04.1_amd64.deb ...
Unpacking libmysqlclient-dev (8.0.23-0ubuntu0.20.04.1) ...
Setting up libssl1.1:amd64 (1.1.1f-1ubuntu2.3) ...
Setting up libssl-dev:amd64 (1.1.1f-1ubuntu2.3) ...
Setting up libmysqlclient-dev (8.0.23-0ubuntu0.20.04.1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Installing dependency for mysqlclient
Now, you just need to install the dependency for mysqlclient called libmysqlclient-dev.
sudo apt-get install libmysqlclient-dev
libmysqlclient-dev is a package that provides all the essential dependencies and resources to the system required for the functioning of mysqlclient.
For Python3.9
sudo apt-get install python3.9-dev build-essential
Finally, pip install mysqlclient
Now, you can install mysqlclient with no tension.
python3 -m pip install mysqlclient
or
pip3 install mysqlclient
В Django изначально реализована поддержка баз данных MySQL и MariaDB. Общение с этими базами выполняется через разные библиотеки, в том числе mysqlclient. Библиотека mysqlclient является самой быстрой и рекомендуемой при работе с Django и MySQL, но ее установка не всегда очевидна и вы можете столкнуться с рядом проблем.
Библиотеки для работы с MySQL в Python
Скорее всего их больше, какие-то библиотеки более не поддерживаются, но обычно выделяют 3 варианта для работы с базами MySQL в Python:
- mysqclient — библиотека написанная на С, которая компилируется при установке. Является форком старого проекта MySQLdb1, который давно не поддерживается. Рекомендуется разработчиками Django и имеет самые высокие показатели производительности из остальных;
- mysql-connector-python — это официальная библиотека от Oracle. На момент написания статьи можно встретить информацию, что разработчики переписали ее на Python 3, но это не так. Библиотека написана на Python 2.7, а поддержка этой версии закончилась в Django 2.0. В документации Django, почему-то, до сих пор можно прочитать о поддержке этого модуля. Библиотека имела самые низкие показатели скорости;
- pymysql — сторонний проект написанные на Python 3. Django официально не поддерживает эту библиотеку. Создана теми же разработчиками, что и mysqlclient.
При установке библиотеки mysqlclient, на любой платформе (особенно на Windows), могут быть проблемы с компиляцией. Часть ошибок, которые у вас могут появиться:
- django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?
- building ‘_mysql’ extension error: Microsoft Visual C++ 14.0 is required.
- ModuleNotFoundError: No module named ‘MySQLdb’
Если у вас есть похожие проблемы, то я бы рекомендовал использовать mysqlclient на сервере (как самую быструю библиотеку), а pymysql использовать локально. О том как это сделать и как можно исправить ошибки написано далее.
Само собой статья исключает ситуацию, что вы можете использовать PostgreSQL в своем проекте.
pymysql
Самый простой и быстрый способ исправить ошибку — установить библиотеку pymysql:
python3 -m pip install PyMySQL
Что бы вы смогли использовать ее в Django, в файле settings.py вам нужно импортировать библиотеку и использовать метод для подключения к API MySQLdb:
import pymysql
pymysql.install_as_MySQLdb()
Эти настройки может понадобится положить в другие файлы, такие как ‘__init__.py’ или ‘manage.py’. Это зависит от вашего проекта. Суть в том, что мы должны импортировать pymysql до того, как будет выполнен импорт MySQLdb. Обычно это происходит в ‘settings.py’ в DATABASES.
Ниже пример файла настроек, который использую я при локальной разработке:

На странице проекта в github есть уточнение, которое касалось версий Django 2.2+ и следующей ошибкой:
- django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3;
Я эту ошибку не встречал, но исправить ее можно вручную заменив версию mysqlclient следующим образом:
import pymysql
pymysql.version_info = (1, 4, 6, 'final', 0)
pymysql.install_as_MySQLdb()
Каких либо ошибок при работе с этой библиотекой я не замечал.
mysqlclient
Перед установкой библиотеки mysqclient, в случае Linux, вам понадобится установить целый ряд дополнительных пакетов для компиляции:
# Разработчики указывают следующие пакеты
# Ubuntu
sudo apt-get install python3-dev default-libmysqlclient-dev build-essential
# CentOS
sudo yum install python3-devel mysql-devel
# библиотеки, которые могут понадобится
# (советы с форумов, которые мне не пригодились)
sudo apt-get install mysql-client libssl-dev
В качестве эксперимента я установил чистый Windows 10 и Django 3.2 и ошибок с mysqlclient не было. Возможно разработчики что-то исправили. Если на Windows у вас все равно появляются ошибки, то вы можете скачать скомпилированную версию и установить ее через pip:
python3 -m pip install C:/mysqlclient-1.4.6-cp39-cp39-win32.whl
В случае Windows этот способ у меня не всегда срабатывал. Поэтому я предпочитаю, если использую MySQL, использовать PyMySQL локально, а mysqlclient на сервере.
Далее устанавливаем саму библиотеку через pip:
python3 -m pip install mysqlclient
mysql-connector-python
Эта официальная библиотека от разработчиков Oracle написанная на Python 2.7. Эта библиотека так же поддерживается разработчиками Django. В более новых версиях Django 3+ можно увидеть следующую ошибку:
- ‘mysql.connector.django’ isn’t an available database backend or couldn’t be imported. Check the above exception. To use one of the built-in backends, use ‘django.db.backends.XXX’, where XXX is one of: ‘mysql’, ‘oracle’, ‘postgresql’, ‘sqlite3’
В Django 2.2 можно увидеть следующую ошибку:
- django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?
Эти ошибки связаны с отсутствием поддержки Python 2.7 начиная с Django 2.0. В марте 2020 года (прошел год с написания статьи) разработчики отписывались о том что в курсе этой проблемы и решают ее. Вы можете попытать удачу и установить этот модуль следующим образом:
python3 -m pip install mysql-connector-python
В файле setting.py указать следующие настройки:
DATABASES = {
'default': {
'ENGINE': 'mysql.connector.django',
'NAME': ,
'USER': ,
'PASSWORD': ,
'HOST': ,
}
}
…
Теги:
#python
#django
i do this
# Create options
libs="-L$pkglibdir"
libs="$libs -lmysqlclient -lssl -lcrypto"
but a new problem has come up
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.6-intel-3.5
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -Dversion_info=(1,3,10,'final',0) -D__version__=1.3.10 -I/usr/local/Cellar/mysql-connector-c/6.1.10/include -I/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c _mysql.c -o build/temp.macosx-10.6-intel-3.5/_mysql.o
/usr/bin/clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-intel-3.5/_mysql.o -L/usr/local/Cellar/mysql-connector-c/6.1.10/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.6-intel-3.5/_mysql.cpython-35m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit status 1
This detailed output
Collecting mysqlclient
1 location(s) to search for versions of mysqlclient:
* https://pypi.python.org/simple/mysqlclient/
Getting page https://pypi.python.org/simple/mysqlclient/
...
Downloading from URL https://pypi.python.org/packages/40/9b/0bc869f290b8f49a99b8d97927f57126a5d1befcf8bac92c60dc855f2523/mysqlclient-1.3.10.tar.gz#md5=e7fb95c4055e2d8a3322db5c85ab6fc8 (from https://pypi.python.org/simple/mysqlclient/)
Running setup.py (path:/private/var/folders/1k/_yh_dpzn721401tdqztp_qb40000gn/T/pip-build-32q202m5/mysqlclient/setup.py) egg_info for package mysqlclient
Running command python setup.py egg_info
running egg_info
creating pip-egg-info/mysqlclient.egg-info
writing pip-egg-info/mysqlclient.egg-info/PKG-INFO
writing top-level names to pip-egg-info/mysqlclient.egg-info/top_level.txt
writing dependency_links to pip-egg-info/mysqlclient.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/mysqlclient.egg-info/SOURCES.txt'
reading manifest file 'pip-egg-info/mysqlclient.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'GPL-2.0'
writing manifest file 'pip-egg-info/mysqlclient.egg-info/SOURCES.txt'
Source in /private/var/folders/1k/_yh_dpzn721401tdqztp_qb40000gn/T/pip-build-32q202m5/mysqlclient has version 1.3.10, which satisfies requirement mysqlclient from https://pypi.python.org/packages/40/9b/0bc869f290b8f49a99b8d97927f57126a5d1befcf8bac92c60dc855f2523/mysqlclient-1.3.10.tar.gz#md5=e7fb95c4055e2d8a3322db5c85ab6fc8
Building wheels for collected packages: mysqlclient
Running setup.py bdist_wheel for mysqlclient: started
Destination directory: /var/folders/1k/_yh_dpzn721401tdqztp_qb40000gn/T/tmp_xiqz2w4pip-wheel-
Running command /Users/ning-pc/Envs/python3.5/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/1k/_yh_dpzn721401tdqztp_qb40000gn/T/pip-build-32q202m5/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/1k/_yh_dpzn721401tdqztp_qb40000gn/T/tmp_xiqz2w4pip-wheel- --python-tag cp35
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.6-intel-3.5
...
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.6-intel-3.5
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -Dversion_info=(1,3,10,'final',0) -D__version__=1.3.10 -I/usr/local/Cellar/mysql-connector-c/6.1.10/include -I/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c _mysql.c -o build/temp.macosx-10.6-intel-3.5/_mysql.o
/usr/bin/clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-intel-3.5/_mysql.o -L/usr/local/Cellar/mysql-connector-c/6.1.10/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.6-intel-3.5/_mysql.cpython-35m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit status 1
Running setup.py bdist_wheel for mysqlclient: finished with status 'error'
Running setup.py clean for mysqlclient
Running command /Users/ning-pc/Envs/python3.5/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/1k/_yh_dpzn721401tdqztp_qb40000gn/T/pip-build-32q202m5/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" clean --all
running clean
removing 'build/temp.macosx-10.6-intel-3.5' (and everything under it)
removing 'build/lib.macosx-10.6-intel-3.5' (and everything under it)
'build/bdist.macosx-10.6-intel' does not exist -- can't clean it
'build/scripts-3.5' does not exist -- can't clean it
removing 'build'
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient: started
Running command /Users/ning-pc/Envs/python3.5/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/1k/_yh_dpzn721401tdqztp_qb40000gn/T/pip-build-32q202m5/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/1k/_yh_dpzn721401tdqztp_qb40000gn/T/pip-_rn86vr2-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ning-pc/Envs/python3.5/bin/../include/site/python3.5/mysqlclient
running install
running build
running build_py
creating build
creating build/lib.macosx-10.6-intel-3.5
copying _mysql_exceptions.py -> build/lib.macosx-10.6-intel-3.5
creating build/lib.macosx-10.6-intel-3.5/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.6-intel-3.5/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.6-intel-3.5/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.6-intel-3.5/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.6-intel-3.5/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.6-intel-3.5/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.6-intel-3.5/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.6-intel-3.5/MySQLdb
creating build/lib.macosx-10.6-intel-3.5/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.6-intel-3.5/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.6-intel-3.5/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.6-intel-3.5/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.6-intel-3.5/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.6-intel-3.5/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.6-intel-3.5/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.6-intel-3.5/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.6-intel-3.5
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -Dversion_info=(1,3,10,'final',0) -D__version__=1.3.10 -I/usr/local/Cellar/mysql-connector-c/6.1.10/include -I/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c _mysql.c -o build/temp.macosx-10.6-intel-3.5/_mysql.o
/usr/bin/clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-intel-3.5/_mysql.o -L/usr/local/Cellar/mysql-connector-c/6.1.10/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.6-intel-3.5/_mysql.cpython-35m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit status 1
Running setup.py install for mysqlclient: finished with status 'error'
Cleaning up...
Removing source in /private/var/folders/1k/_yh_dpzn721401tdqztp_qb40000gn/T/pip-build-32q202m5/mysqlclient
Exception information:
Traceback (most recent call last):
File "/Users/ning-pc/Envs/python3.5/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Users/ning-pc/Envs/python3.5/lib/python3.5/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Users/ning-pc/Envs/python3.5/lib/python3.5/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/Users/ning-pc/Envs/python3.5/lib/python3.5/site-packages/pip/req/req_install.py", line 878, in install
spinner=spinner,
File "/Users/ning-pc/Envs/python3.5/lib/python3.5/site-packages/pip/utils/__init__.py", line 707, in call_subprocess
% (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command "/Users/ning-pc/Envs/python3.5/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/1k/_yh_dpzn721401tdqztp_qb40000gn/T/pip-build-32q202m5/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/1k/_yh_dpzn721401tdqztp_qb40000gn/T/pip-_rn86vr2-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ning-pc/Envs/python3.5/bin/../include/site/python3.5/mysqlclient" failed with error code 1 in /private/var/folders/1k/_yh_dpzn721401tdqztp_qb40000gn/T/pip-build-32q202m5/mysqlclient/