【问题标题】:Using pip in venv (WIndows 10)在 venv 中使用 pip (Windows 10)
【发布时间】:2021-10-02 14:52:29
【问题描述】:

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

我建立了一个 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吗?如果是的话,究竟是什么方式。 可以加吗

【问题讨论】:

  • 这个问题是不是只出现在虚拟环境中?听起来 SSL 库无论如何都应该安装在全局级别。
  • 哪个python版本?
  • 好吧,当不添加 \Library\bin 路径时,这似乎是一个已知问题,我想我正在使用 python 3.8.5

标签: python ssl pip python-venv


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-01-14
    • 2017-07-27
    • 1970-01-01
    • 1970-01-01
    • 2019-05-23
    • 1970-01-01
    • 2020-09-07
    • 1970-01-01
    相关资源
    最近更新 更多