Mac平台安装mysql-connector-python

通过pip的方式安装失败

pip install mysql-connector-python --allow-external mysql-connector-python

提示:No matching distribution found for mysql-connector-python

Stack Overflow提供的解决方案

$  git clone https://github.com/mysql/mysql-connector-python.git
$  cd mysql-connector-python
$  python ./setup.py build
$  sudo python ./setup.py install

...

>>> import mysql.connector as msc
>>> msc.__version__
'2.1.3'
>>>

说明:如果使用Python3.X,则对应将python/pip改为python3/pip3

八宝粥 wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!