1、首先用pip来安装pymysql
pip install mysql
报错:
cryptography requires setuptools 18.5 or newer, please upgrade to a new version
2、我想到的是更新pip
sudo pip install --upgrade pip
其实需要更新的是setuptools:
sudo pip install -t /usr/local/lib/python3.6/site-packages/ setuptools
3、使用pip将pymysql安装到想要的地方
针对多python版本的情况:
安装到python2.7:
sudo pip install pymysql
安装到python3.4:
sudo pip install -t /usr/local/lib/python3.4/site-packages/ pymysql
安装到python3.6:
sudo pip install -t /usr/local/lib/python3.6/site-packages/ pymysql
安装到虚拟环境中:
sudo pip install -t ~/Pycharm/py36env/lib/python3.6/site-packages pymysql
报错:
Could not fetch URL https://pypi.python.org/simple/requests/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
解决方式:
sudo pip --trusted-host pypi.python.org install -t ~/PycharmProjects/py36env/lib/python3.6/site-packages/ mysql
问题解决。
原文来源:https://m.pythontab.com/article/1317
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦