当前位置:   article > 正文

VScode配置conda虚拟环境_vscode conda环境

vscode conda环境

VScode安装好以后,打开一个Python文件,需要选择一个Python解释器

  1. 输入Ctrl+shift+p,会出现命令提示

2.选中python:select interpreter 选择要使用的Python解释器

 3.配置文件中进行配置:

  1. lauch.json
  2. {
  3.     // Use IntelliSense to learn about possible attributes.
  4.     // Hover to view descriptions of existing attributes.
  5.     // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  6.     "version": "0.2.0",
  7.     "configurations": [
  8.       
  9.         {
  10.             "name": "Python: /home/user/anaconda3/envs/test/bin/python",
  11.             "type": "python",
  12.             "request": "launch",
  13.             "program": "*/plot.py",
  14.             "console": "integratedTerminal",
  15.             "justMyCode": true,
  16.             "externalConsole":false,
  17.         }
  18.     ]
  19. }

[Python][VsCode]报错 python:命令“Python:Select:Interpreter“ command ‘python.setInterpreter‘ not found 

错误情况:
在使用ctrl+shift+P后使用Python:Select:Interpreter切换解释器出错

报错如下

 解决方案:
在左侧扩展栏目中搜索@workspaceUnsupported 

发现python在限制在受限模式下

 点击蓝圈中选项

 然后选择信任,问题解决



原文链接:https://blog.csdn.net/m0_56738500/article/details/127144144

(4)运行命令添加参数:添加”args“字段

在这里插入图片描述

 其中的args就是我们需要添加的参数项,根据程序里面设置的参数项进行设置即可,我这里是已经添加好了的。保存后点击界面右上角的Debug Python File按钮,发现还是报同样的错误。可是参数已经在launch.json文件里面进行设置了的。这也许是因为vscode自身bug的原因,在设置好调试文件后不能直接通过Debug Python File按钮运行,而要按键盘上的F5运行,这样就不会报错了,对应的参数也都能传进去。

原文链接:https://blog.csdn.net/weixin_44120025/article/details/121246123

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/788309
推荐阅读
相关标签
  

闽ICP备14008679号