PyCharm 不会为我的项目创建任何 venv。我必须手动创建它们。
zipapp 出现错误:
File "C:\Users\marco.sulla\Programs\pycharm\plugins\python-ce\helpers\virtualenv-20.16.7.pyz\virtualenv\util\zipapp.py", line 19, in extract
import {module}
File "C:\Users\marco.sulla\AppData\Local\Programs\python39\lib\zipfile.py", line 1438, in getinfo
raise KeyError(
KeyError: "There is no item named 'ate/via_global_ref/_virtualenv.py' in the archive"
这里是完整的堆栈跟踪:
Traceback (most recent call last):
File "C:\Users\marco.sulla\AppData\Local\Programs\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\marco.sulla\AppData\Local\Programs\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\marco.sulla\Programs\pycharm\plugins\python-ce\helpers\virtualenv-20.16.7.pyz\__main__.py", line 167, in <module>
File "C:\Users\marco.sulla\Programs\pycharm\plugins\python-ce\helpers\virtualenv-20.16.7.pyz\__main__.py", line 163, in run
File "C:\Users\marco.sulla\Programs\pycharm\plugins\python-ce\helpers\virtualenv-20.16.7.pyz\virtualenv\__main__.py", line 16, in run
File "C:\Users\marco.sulla\Programs\pycharm\plugins\python-ce\helpers\virtualenv-20.16.7.pyz\virtualenv\run\__init__.py", line 30, in cli_run
File "C:\Users\marco.sulla\Programs\pycharm\plugins\python-ce\helpers\virtualenv-20.16.7.pyz\virtualenv\run\session.py", line 42, in run
File "C:\Users\marco.sulla\Programs\pycharm\plugins\python-ce\helpers\virtualenv-20.16.7.pyz\virtualenv\run\session.py", line 49, in _create
File "C:\Users\marco.sulla\Programs\pycharm\plugins\python-ce\helpers\virtualenv-20.16.7.pyz\virtualenv\create\creator.py", line 153, in run
File "C:\Users\marco.sulla\Programs\pycharm\plugins\python-ce\helpers\virtualenv-20.16.7.pyz\virtualenv\create\via_global_ref\builtin\via_global_self_do.py", line 93, in create
File "C:\Users\marco.sulla\Programs\pycharm\plugins\python-ce\helpers\virtualenv-20.16.7.pyz\virtualenv\create\via_global_ref\api.py", line 83, in create
File "C:\Users\marco.sulla\Programs\pycharm\plugins\python-ce\helpers\virtualenv-20.16.7.pyz\virtualenv\create\via_global_ref\api.py", line 86, in install_patch
File "C:\Users\marco.sulla\Programs\pycharm\plugins\python-ce\helpers\virtualenv-20.16.7.pyz\virtualenv\create\via_global_ref\api.py", line 97, in env_patch_text
File "C:\Users\marco.sulla\AppData\Local\Programs\python39\lib\contextlib.py", line 119, in __enter__
return next(self.gen)
File "C:\Users\marco.sulla\Programs\pycharm\plugins\python-ce\helpers\virtualenv-20.16.7.pyz\virtualenv\app_data\base.py", line 54, in ensure_extracted
File "C:\Users\marco.sulla\AppData\Local\Programs\python39\lib\contextlib.py", line 119, in __enter__
return next(self.gen)
File "C:\Users\marco.sulla\Programs\pycharm\plugins\python-ce\helpers\virtualenv-20.16.7.pyz\virtualenv\app_data\via_disk_folder.py", line 78, in extract
File "C:\Users\marco.sulla\Programs\pycharm\plugins\python-ce\helpers\virtualenv-20.16.7.pyz\virtualenv\util\zipapp.py", line 19, in extract
import {module}
File "C:\Users\marco.sulla\AppData\Local\Programs\python39\lib\zipfile.py", line 1438, in getinfo
raise KeyError(
KeyError: "There is no item named 'ate/via_global_ref/_virtualenv.py' in the archive"
我在 Windows 11 上使用 PyCharm 2023.2.1 社区版和 Python 3.9
我解决了。我从符号链接安装了 PyCharm。卸载并使用完整路径重新安装它解决了问题。这是
zipapp
的已知缺陷: