[英]Mac OSX Catalina Broke All Python Venv's
Just recently upgraded to Mac OSX Catalina, and it seems to have broken all my Python venv's.最近刚刚升级到 Mac OSX Catalina,它似乎破坏了我所有的 Python venv。
source venv/bin/activate
source venv/bin/activate
python
or python3
, it actually runs the system Python interpreters, instead of the expected Python interpreter in my venv.python
或python3
,它实际上运行系统 Python 解释器,而不是我的 venv 中预期的 Python 解释器。 With my venv activated...随着我的 venv 激活...
>>> which python
/usr/bin/python
>>> which python3
/usr/local/bin/python3
I expect that to point to /Users/<username>/<path-to-venv>/venv/bin/python3
.我希望它指向
/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
python3
file exists, although it's actually an alias.python3
文件存在,尽管它实际上是一个别名。 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.
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.所以我认为这些 venv 的工作方式是它们基于对现有 Python 解释器安装的引用。 Evidently running a venv invokes these references, and if the original installation is broken it fails.
显然运行 venv 会调用这些引用,如果原始安装被破坏,它就会失败。 I know that Catalina jacked with the default Python settings and went so far as to change installation directories.
我知道 Catalina 使用默认的 Python 设置,甚至更改了安装目录。
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 虚拟环境。
You can try to create a new venv in the same folder or to update your existing venv.您可以尝试在同一文件夹中创建一个新的 venv 或更新您现有的 venv。 With all the following I assume you've created your virtual environments with the bundled venv module
通过以下所有内容,我假设您已经使用捆绑的venv模块创建了虚拟环境
python3 -m venv <path_to_dir>
--upgrade
parameter is what you're looking for.--upgrade
参数就是你要找的。 You need to run it with the targeted Python version, for example in this case:您需要使用目标 Python 版本运行它,例如在这种情况下:
python3 -m venv --upgrade <path_to_dir>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.