简体   繁体   English

两个 python 解释器之间的区别

[英]difference between two python interpreters

I'm setting a python environment for new M1 mac(newbie of MacOS).我正在为新的 M1 mac(MacOS 的新手)设置一个 python 环境。

What I've done is installing Xcode, VScode, homebrew, and python3 in VScode installing extensions.我所做的是在 VScode 安装扩展中安装 Xcode、VScode、homebrew 和 python3。

Then I tried to build some python project, and i met two interpreters with same version.然后我尝试构建一些 python 项目,我遇到了两个相同版本的解释器。

Python 3.8.2 with local one and Xcode's. Python 3.8.2,带有本地版本和 Xcode。

在此处输入图像描述

I'm afraid of two python interpreters mixing each other like anaconda python and local one(what i've faced in Windows).我害怕两个 python 解释器相互混合,例如 anaconda python 和本地解释器(我在 Windows 中遇到的情况)。

Can I delete one to prevent further problem?我可以删除一个以防止进一步的问题吗? Or I really don't have to?还是我真的不需要?

What I usually do is setup a virtualenv for the project and point VSCode at the virtualenv 's Python interpreter.我通常做的是为项目设置一个virtualenv并将 VSCode 指向virtualenv的 Python 解释器。

~/dev/project $ virtualenv venv

In VSCode: CMD+Shift+P => Python: Select interpreter在 VSCode 中: CMD+Shift+P => Python: Select interpreter

Python:选择解释器

The list of interpreters should inclue the one inside the newly created venv :解释器列表应包括新创建的venv中的解释器:

可用的 Python 解释器列表

Reference: https://code.visualstudio.com/docs/python/environments参考: https://code.visualstudio.com/docs/python/environments

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM