Cannot Install Mysqlclient
I am using python3.8 in django framework, for that I have to install mysqlclient. But error is coming when I try pip3 install mysqlclient output like this as error. Collecting mys
Solution 1:
I think libffi-dev libary file is missing in your system/server. use the below command in order to check library installed or not
apt-cache search libffi
to install libffi-dev
sudo apt-get install -y libffi-dev
After that try
pip3 install mysqlclient
Approach 2
sudo apt-get install python-dev default-libmysqlclient-dev
sudo apt-get install python3-dev
pip install mysqlclient
Solution 2:
ModuleNotFoundError: No module named '_ctypes'
occurring because of python bug. In latest version of python this bug was solved.
- There for you have to update your pip
- Next you have to run this
yum install libffi-deve
orsudo dnf install libffi-devel
- After that run
pip3 install mysqlclient
orsudo yum install python36u-devel mysql-devel
to install mysqlclient.
Solution 3:
My problem is solved. When I installed python-3.8.0, I did not compile it, that was the problem. I am using Centos7, so I went to the root of the terminal, first install prerequisites for Python before installing it.
# sudo yum install gcc openssl-devel bzip2-devel libffi-devel
download latest version
#wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
Now extract the downloaded package.
Compile Python Source
#cd Python-3.8.0
#sudo ./configure --enable-optimizations
make altinstall is used to prevent replacing the default python binary file /usr/bin/python.
#sudo make altinstall
remove downloaded source archive file from your system
#sudo rm Python-3.8.0.tgz
Check Python Version
#python3.8 -V
Then I could be able to install mysqlclient by
# pip3 install mysqlclient
Post a Comment for "Cannot Install Mysqlclient"