简体   繁体   English

为什么我的 VSCode 解释器在 Mac 上不起作用?

[英]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.

相关问题 Mac Pycharm解释器不起作用 - Mac Pycharm Interpreter not working 为什么 `python` 指向我系统默认的 python 解释器,而不是我的 `pyenv` python 解释器? - Why does `python` point to my system's default python interpreter, instead of my `pyenv` python interpreter? 为什么我的任何笔记本在Zeppelin 0.8.0上都无法使用python解释器? - Why is python interpreter not working on Zeppelin 0.8.0 for any of my notebooks? Formatter black 在我的 VSCode 上不起作用......但为什么呢? - Formatter black is not working on my VSCode...but why? 为什么在vscode中点击select Python解释器没有反应? - Why clicking select Python interpreter in vscode with no response? 即使在激活环境后,VSCode Mac 仍显示不正确的解释器 - VSCode Mac shows incorrect interpreter even after activation of environment 为什么硒不能在我的Mac上正常工作? - Why is selenium not working properly on my mac? 为什么我对 Python 的导入不能在 VSCode 中工作? - Why aren't my imports for Python working in VSCode? 为什么 matplotlib 在 VSCode 上不起作用 - Why matplotlib is not working on the VSCode 如何在WSL中将python3设置为VSCode中的解释器? - How can I setup python3 in my WSL as an interpreter in VSCode?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM