[PYTHON] How to install mysql-connector with pip3

Python is an amateur who made a tool when Python3 was just released, but I was addicted to building an environment at work and could not refer to mysql-connector from python3, so I made a note.

In the environment where python (2.7.x) and python3 (3.4.x) are installed, there was mysql-connector-python in pip list, but it does not exist in pip3 list and it seems that it can not be referenced from python3 did.

Can't install

If it is not in pip3, you can install it with pip3 ...

Console


$ sudo pip3 install mysql-connector-python

Cannot install with the following error

  Could not find a version that satisfies the requirement mysql-connector-python (from versions: )
No matching distribution found for mysql-connector-python

Is this for python (2.x), pip?

pip3 search mysql-connector

What is displayed in ...?

Can be installed

With pip3 search, I installed the following that appeared in the line immediately below.

Console


$ sudo pip3 install mysql-connector-python-rf

I was able to install this without any problems. I don't know what rf is, but it seemed to be prepared by another name.

bonus

There are some posts from people who are having trouble on stackoverflow.com, and I was able to solve it by following the steps below.

Console


$ echo https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.3.tar.gz >> requirements.txt
$ sudo pip3 install -r ./requirements.txt

cf. http://stackoverflow.com/questions/34489271/i-cannot-install-mysql-connector-python-using-pip

Supplement

When I was involved in the environment construction, Flask + SQLAlchemy + MySQL environment construction was not successful.

Recommended Posts

How to install mysql-connector with pip3
How to install pip
How to install Anaconda with pyenv
How to install DLIB with 2020 / CUDA enabled
I want to pip install with PythonAnywhere
How to install zsh (with .zshrc customization)
How to install python3 with docker centos
How to install Python
How to install archlinux
How to install python
How to install BayesOpt
How to install Nbextensions
How to install Prover9
Install scikit.learn with pip
How to deal with errors when hitting pip ②
How to install pip, numpy in Autodesk MAYA
How to install OpenGM on OSX with macports
Steps to install your own library with pip
[2020.8 latest] How to install Python
How to install Python [Windows]
Tabpy 1.0 (2020-01 version) How to install
When moss with pip install
Install github repository with pip
How to update with SQLAlchemy?
How to install mkl numpy
How to Alter with SQLAlchemy?
How to separate strings with','
How to Delete with SQLAlchemy?
How to install caffe on OS X with macports
How to deal with "No module named'〇〇'" error in Jupyter Notebook | Install with! Pip!
How to install python using anaconda
How to cancel RT with tweepy
Python: How to use async with
How to install NPI + send a message to line with python
How to install Python2.7 python3.5 with pyenv (on RHEL5 CentOS5) (2016 Nov)
Install Python 2.7.9 and Python 3.4.x with pip.
How to install mysql-connector-python on mac
How to install and use Tesseract-OCR
What to do with Magics install
Permission denied with pip install pyopenssl
How to use virtualenv with PowerShell
How to deal with imbalanced data
How to install graph-tool on macOS
How to install wkhtmltopdf (Amazon Linux2)
How to install VMware-Tools on Linux
How to install pycrypto on Windows
How to install OpenCV on Mac
How to install PyPy on CentOS
How to get started with Scrapy
Easy to install pyspark with conda
How to install TensorFlow on CentOS 7
How to deal with DistributionNotFound errors
How to install and configure blackbird
How to get started with Django
How to install CUDA and nvidia-driver
Manipulate colors with pip install color
How to install and use Graphviz
Unable to install Python with pyenv
How to Data Augmentation with PyTorch
How to use FTP with Python
How to calculate date with python