微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 VSCode 虚拟环境中安装 numpy 时,pip 配置了需要 TLS/SSL 的位置

如何解决在 VSCode 虚拟环境中安装 numpy 时,pip 配置了需要 TLS/SSL 的位置

我收到错误

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

尝试在 Visual Studio 代码中的虚拟环境中安装 numpy 时。我注意到以下几点:

  1. 如果我在 VS 代码中的虚拟环境之外执行“pip install numpy”,则一切正常。
  2. 虽然我使用“py -3 -m venv NameOfVirtualEnvironment”在 VS 代码中创建虚拟环境,但没有创建 .vscode 文件
  3. 我无法按照之前类似帖子中的建议执行“pip install SSL”或任何其他补救措施来解决问题。
  4. 我可以在命令窗口中顺利“pip install numpy”。

这是我收到的详细错误消息:

pip is configured with locations that require TLS/SSL,however the ssl module in Python is not available.
Collecting numpy
  retrying (Retry(total=4,connect=None,read=None,redirect=None,status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  retrying (Retry(total=3,status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  retrying (Retry(total=2,status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  retrying (Retry(total=1,status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  retrying (Retry(total=0,status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  Could not fetch URL https://pypi.org/simple/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org',port=443): Max retries exceeded with url: /simple/numpy/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy
pip is configured with locations that require TLS/SSL,however the ssl module in Python is not available.
 Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org',port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。