在使用pip安装openmim的时候,报错:
Collecting openmim
Could not fetch URL https://pypi.python.org/simple/openmim/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748) - skipping
Could not find a version that satisfies the requirement openmim (from versions: )
No matching distribution found for openmim
出现这个错误通常是因为Python环境无法验证SSL证书。这可能是因为系统中缺少必要的证书或者证书库过时。解决这个问题的方法有几种:
1. 更新系统的CA证书
sudo apt-get update && sudo apt-get install --reinstall ca-certificates
2. 更新python的SSL包
sudo apt-get update && sudo apt-get install --reinstall ca-certificates
3. 手动指定证书
pip install --trusted-host pypi.python.org --cert /path/to/your/cacert.pem openmim
4. 临时忽略SSL证书验证(不推荐,除非确定网站没问题)
pip install --trusted-host pypi.python.org openmim
当然最后一种方法是最方便的,我用最后一种方法解决了问题,成功安装了openmim。但是风险也很高,访问安全网站的时候再考虑这个方式。