首页 > 解决方案 > 在 venv 中使用 pip (Windows 10)

问题描述

我见过类似的问题,但我没有看到我的问题的明确解决方案:

我设置了一个 python 虚拟环境并想安装 python 库。我在 Windows 10 上使用 VisualStudio Code,使用 pip 安装时出现以下错误:

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

重试5次后:

Could not fetch URL https://pypi.org/simple/opencv/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries 
exceeded with url: /simple/opencv/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

似乎解决方案是添加

D:\Anaconda3 
D:\Anaconda3\Scripts
D:\Anaconda3\Library\bin

到路径。在这里找到的解决方案:

https://stackoverflow.com/questions/45954528/pip-is-configured-with-locations-that-require-tls-ssl-however-the-ssl-module-in

但是由于我没有使用 anaconda 并且在虚拟环境中,所以我不能这样做吗?那么我必须编辑activate.bat吗?如果是的话,究竟是什么方式。我可以添加吗

标签: pythonsslpippython-venv

解决方案


安装 OpenSSL 对我有用。似乎dll的版本有问题。可以在此处找到更多信息,但这对我来说已经足够了。

https://stackoverflow.com/a/67653437/15980312


推荐阅读