在 MacOS 上的 virtualenv 中使用特定的 Python 版本

发布于 2025-01-17 10:39:46 字数 1203 浏览 3 评论 0原文

我的MacOS上安装了三个Python版本:Python 2.7.18,Python 3.9.0和Python 3.10。

Python 2.7.18和Python 3.9.0被添加到路径中,这可以在下面的屏幕截图中看到。

对我来说还可以。我现在想将Python 3.10添加到路径上。但是,我想在虚拟的内部使用它。

Python 3.10以下目录/usr/usr/local/opt/受保护]

我的项目位于这里/users/david/david/documents/project

我尝试使用以下命令(在我的项目目录内):sudo virtualenv venv -python .usr/local/opt/ [email  preconted]。不幸的是,它与以下错误RuntimeError:无法找到bython_spec ='。 =“ __ cf_email__” data-cfemail =“ 0D74796562634D3E233C3D”> [email  procearted] '

如何创建我的Virtualenv?

I have three Python version installed on my MacOs: Python 2.7.18, Python 3.9.0 and Python 3.10.

Python 2.7.18 and Python 3.9.0 are added into the Path which can be seen in the screenshot below.

enter image description here

That is OK for me. I do now want to add Python 3.10 to path. However I would like to use it inside my virtualenv.

Python 3.10 is installed under the following directory /usr/local/opt/[email protected].

enter image description here

My project is located here /Users/David/Documents/Project.

I tried to use the following command (inside my project's directory): sudo virtualenv venv --python .usr/local/opt/[email protected]. Unfortunately it didn't work with the following error RuntimeError: failed to find interpreter for Builtin discover of python_spec='.usr/local/opt/[email protected]'.

How can I create my virtualenv?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

◇流星雨 2025-01-24 10:39:48

看起来像是 [email protected] 的路径有错误 - 前面有 . 指示当前目录,请尝试/usr/local/opt/[电子邮件受保护].

Looks like your path to [email protected] has an error - it has . at the front indicating the current directory, try /usr/local/opt/[email protected].

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文