[英]Why my VSCode's interpreter is not working in Mac?
I have VSCode and I am trying to set up a virtual environment.我有 VSCode,我正在尝试建立一个虚拟环境。 First, I created all the venv properly.
首先,我正确地创建了所有的 venv。 When I run in the Terminal is working and activated.
当我在终端运行时正在工作并激活。 However, it is not showing up in the VSCode.
但是,它没有出现在 VSCode 中。 Make the matter worse, I can not change my interpreter at all.
更糟糕的是,我根本无法改变我的翻译。 At first, I had python 2.7 and I could not change into python3 even though everything is set up properly.
起初,我有 python 2.7,即使一切设置正确,我也无法更改为 python3。 I fixed that problem with this setting "code-runner.executorMap.python": "python3 -u" .
我用这个设置解决了这个问题"code-runner.executorMap.python": "python3 -u" 。 And how I cannot change to another interpreter without the delete the setting.
以及如何在不删除设置的情况下更改为另一个解释器。 I am not sure what to do.
我不知道该怎么做。 Please help.
请帮忙。 Thanks
谢谢
Others have reported setting up virtual environments using VSCode.其他人报告说使用 VSCode 设置虚拟环境。 I suggest you set up your virtual environment using the terminal and activating the environment before starting VSCode.
我建议您在启动 VSCode 之前使用终端设置虚拟环境并激活环境。 If you are using Anaconda Python this source will instruct you on setting up a virtual environment.
如果您使用的是 Anaconda Python, 此源将指导您设置虚拟环境。 For non-anaconda python, there are many pages for doing the same
对于非 anaconda python,有很多页面可以做同样的事情
To change the interpreter in VSCode, go to the View menu and select the Command Palette.要更改 VSCode 中的解释器,请转到“视图”菜单并选择“命令面板”。 When the command palette opens type python in the text box.
当命令面板打开时,在文本框中键入 python。 This will cause commands with python in its name to be displayed.
这将导致显示名称中带有 python 的命令。 The first command (on my machine) is Python: Select interpreter.
第一个命令(在我的机器上)是 Python: Select interpreter。 Select this and hit return.
选择此项并按回车键。 You will be given a list of python interpreters to choose from.
您将获得一个可供选择的 Python 解释器列表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.