【问题标题】:How to modify Start Without Debugger script for python in MS Visual Studio Code如何在 MS Visual Studio Code 中为 python 修改 Start without Debugger 脚本
【发布时间】:2019-06-01 20:16:52
【问题描述】:

我最近首次安装了 MS Visual Studio Code(我们将在即将进行的项目中使用它)。我在 python 中编写了一个简单的 Hello, World 程序,然后单击 Debug > Start without Debugging。 MSVSC 可以正常运行该程序,但之后它会运行更多命令,其中一个会产生错误(见下文)。这些命令是不必要的,错误是丑陋的和分散注意力的。

MSVSC 正在运行的脚本在哪里?我想删除那两条无用的行。

PS C:\Users\me> cd 'c:\Users\me\Documents\my-project'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'C:\Users\me\Anaconda3\python.exe' 'c:\Users\me\.vscode\extensions\ms-python.python-2019.4.12954\pythonFiles\ptvsd_launcher.py' '--default' '--nodebug' '--client' '--host' 'localhost' '--port' '51699' 'c:\Users\me\Documents\my-project\hello.py'
hello, world
distance 5.0
PS C:\Users\me\Documents\my-project> C:/Users/me/Anaconda3/Scripts/activate
PS C:\Users\me\Documents\my-project> conda activate base
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1
+ conda activate base
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (conda:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\me\Documents\my-project>

【问题讨论】:

    标签: python visual-studio-code


    【解决方案1】:

    它们并不是没用的,你只是碰巧运行了一个不需要激活特定 conda 环境的文件。 we're trying to solve 是 conda 的一个普遍问题。最流畅的体验是使用虚拟环境,如果这对您有用的话。

    【讨论】:

    • 好吧,除了“无用”的评论,你是说没有办法编辑在这里执行的命令集吗?
    • 如果您想要的话,您可以使用 turn off environment activation"python.terminal.activateEnvironment": false
    猜你喜欢
    • 2018-06-16
    • 2016-04-08
    • 1970-01-01
    • 2016-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-17
    • 2020-06-17
    相关资源
    最近更新 更多