PS D:\code\python\my-project> hatch shell
You are about to enter a new shell,exit as you usually would e.g. by typing `exit` or pressing `ctrl+d`...(my-project)PS D:\code\python\my-project> pip list
Package Version
--------------------------
numpy 1.26.4
pandas 2.2.2
pip 24.0
python-dateutil 2.9.0.post0
pytz 2024.1
setuptools 69.5.1
six 1.16.0
tzdata 2024.1
wheel 0.43.0
(my-project)PS D:\code\python\my-project> python -c "import sys;print(sys.executable)"
C:\Users\MyUser\AppData\Local\hatch\env\virtual\my-project\ESvNmHcr\my-project\Scripts\python.exe
注意:不要在进入虚拟环境的模式下执行 $ hatch build,见故障记录
故障记录
https 和 ssl 报错
新安装好后,在项目下使用 $ hatch build 会报错(https 和 ssl 相关)
PS D:\code\python\my-project> hatch -v build
──────────────────────────────────────────────────────── sdist ────────────────────────────────────────────────────────
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/hatchling/
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/hatchling/
WARNING: Retrying (Retry(total=2, 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/hatchling/
WARNING: Retrying (Retry(total=1, 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/hatchling/
WARNING: Retrying (Retry(total=0, 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/hatchling/
Could not fetch URL https://pypi.org/simple/hatchling/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/hatchling/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))- skipping
ERROR: Could not find a version that satisfies the requirement hatchling (from versions: none)
ERROR: No matching distribution found for hatchling