hob*_*777 6 python macos virtualenv python-3.x macos-catalina
Just recently upgraded to Mac OSX Catalina, and it seems to have broken all my Python venv's.
source venv/bin/activatepython or python3, it actually runs the system Python interpreters, instead of the expected Python interpreter in my venv.With my venv activated...
>>> which python
/usr/bin/python
>>> which python3
/usr/local/bin/python3
Run Code Online (Sandbox Code Playgroud)
I expect that to point to /Users/<username>/<path-to-venv>/venv/bin/python3.
>>> /Users/<username>/<path-to-venv>/venv/bin/python3
bash: /Users/<username>/<path-to-venv>/venv/bin/python3: No such file or directory
Run Code Online (Sandbox Code Playgroud)
python3 file exists, although it's actually an alias. If I double-click on it, I get an error message that pops up that reads: The operation can't be completed because the original item for "Python3" can't be found.So I think the way these venv's work is that they are based on references to existing Python interpreter installations. Evidently running a venv invokes these references, and if the original installation is broken it fails. I know that Catalina jacked with the default Python settings and went so far as to change installation directories.
Has anyone else encountered this? Can anyone offer tips to fix this? This seems to affect all my venv virtual environments across my system.
您可以尝试在同一文件夹中创建新的 venv 或更新现有的 venv。通过以下所有内容,我假设您已经使用捆绑的venv模块创建了虚拟环境
python3 -m venv <path_to_dir>
Run Code Online (Sandbox Code Playgroud)
--upgrade参数就是您要查找的内容。您需要使用目标 Python 版本运行它,例如在本例中:
python3 -m venv --upgrade <path_to_dir>
Run Code Online (Sandbox Code Playgroud)
有关更多详细信息,请参阅我的回答这里
| 归档时间: |
|
| 查看次数: |
1648 次 |
| 最近记录: |