简体   繁体   English

如何在VSCode中更改工作区(而非文件夹)的默认python路径

[英]How to change the default python path for a workspace (not a folder) in VSCode

I'm working with VSCode and i am selecting Terminal > New Terminal to start a new terminal session. 我正在使用VSCode,正在选择“终端”>“新终端”以启动新的终端会话。 The problem is, no matter which file is currently selected or which folder I'm currently working out of, the default terminal keeps starting with the a specific virtual Environment for one of the folders in my workspace. 问题是,无论当前选择哪个文件还是我正在使用哪个文件夹,默认终端都从工作区中文件夹之一的特定虚拟环境开始。 How can i change this? 我该如何更改? 新的综合终端会议

You will need to change the interpreter. 您将需要更改解释器。 At the bottom left where the editor says which Python interpreter has been selected ('Python*'), you can click on that and you will be provided with list of interpreters to select from. 在编辑器说选择了哪个Python解释器('Python *')的左下角,您可以单击它,然后将为您提供可供选择的解释器列表。 Alternatively, in windows press ctrl+shift+P and type 'select interpreter' and then select 'Python: Select Interpreter' option. 或者,在Windows中按ctrl + shift + P并键入“选择解释器”,然后选择“ Python:选择解释器”选项。

If you don't see the desired interpreter in the list, you can try adding it to the workspace settings (again ctrl+shift+P and type workspace settings). 如果您在列表中没有找到所需的解释器,则可以尝试将其添加到工作空间设置中(再次按ctrl + shift + P并键入工作空间设置)。 Under workspace settings search for 'python.pythonpath'. 在工作空间设置下搜索“ python.pythonpath”。 You should see an option to update the path to whichever interpreter you want to. 您应该看到一个选项,用于将路径更新为您想要的任何解释器。

More details here 更多细节在这里

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

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