conda 环境下 pre-commit 失败

1. 是 conda 安装的 python 环境导致的失败 

2. 解决:

  - 从官网重新安装个 python

  - 进入刚安装的 python 环境,重新 pip install pre-commit

  - 重新 pre-commit install  (在这之前先把原本目录下的文件删除:C:\\Users\\Administrator\\.cache\\pre-commit\\repoxxxx\

 3. 参考:

https://github.com/pre-commit/pre-commit/issues/2813

https://stackoverflow.com/questions/68794749/unable-to-run-pre-commit-in-anaconda-environment/74689913#74689913

 

[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('C:\\Users\\Administrator\\.cache\\pre-commit\\repo9j87k2fn\\py_env-default\\Scripts\\python.EXE', '-mpip', 'install', '.')
return code: 1
stdout:
    Processing c:\users\administrator\.cache\pre-commit\repo9j87k2fn
      Preparing metadata (setup.py): started
      Preparing metadata (setup.py): finished with status 'done'
    Could not fetch URL https://pypi.org/simple/rapidfuzz/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/rapidfuzz/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
    INFO: pip is looking at multiple versions of pre-commit-hooks to determine which version is compatible with other requirements. This could take a while.
stderr:
    WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
    WARNING: 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/rapidfuzz/        
    WARNING: Retrying (Retry(total=3, 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/rapidfuzz/        
    ERROR: Could not find a version that satisfies the requirement rapidfuzz (from pre-commit-hooks) (from versions: none)
    ERROR: No matching distribution found for rapidfuzz
Check the log at C:\Users\Administrator\.cache\pre-commit\pre-commit.log

 

posted @ 2024-12-22 17:37  _Q  阅读(9)  评论(0编辑  收藏  举报