今天使用pip安裝pymysql時出現如下錯誤:
Could not find a version that satisfies the requirement cryptography (from pymysql) (from versions: )
No matching distribution found for cryptography (from pymysql)
使用pip安裝其他模塊時也可能出現上述錯誤,主要原因是網絡的問題,需要使用國內的鏡像源來加速,比如豆瓣源
因此命令可以使用:
pip install pymysql -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
或者
pip3 install pymysql -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
即可成功安裝。