我使用 conda Python 环境。每当我尝试运行
pre-commit install-hooks
时,都会收到错误
Could not fetch URL https://pypi.org/simple/ruamel-yaml/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded w
ith url: /simple/ruamel-yaml/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
...
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
但是,
pip
在我使用时效果很好。
我已经尝试过
pre-commit clean
、卸载 pre-commit
并重新安装(使用 conda
或 pip
)、更新 pip
、关闭 VPN,以及我在 Google 上可以找到的任何其他解决方案。似乎什么都不起作用。你能帮我吗?
.pre-commit-config.yaml
看起来像这样:
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: stable
hooks:
- id: black
language_version: python3.8
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: isort (python)
Anaconda 环境被破坏,不仅在预提交上,而且在每个使用 SSL 模块的操作上都被破坏。
解决方案:
将这些文件从 Anaconda3/Library/bin 复制到 Anaconda3/DLLs :
libcrypto-{版本}-x64.dll
libssl-{版本}-x64.dll
以下内容对我有帮助: