简体   繁体   English

如何更改 VSCode 中的输出文件?

[英]How do I change the output file in VSCode?

In VSCode, while running python, every time I go to print something, I am met with an error.在 VSCode 中,在运行 python 时,每次我去打印一些东西时,我都会遇到错误。 I can see that I am running a virtualenv that I have deleted and can not for the life of me figure out how to change the output.我可以看到我正在运行一个我已删除的 virtualenv,并且我无法终生弄清楚如何更改输出。 I am sure it is a simple solution, but how does one stop running VSCode output in an old and deleted file, and begin running new code in a working file/directory?我确信这是一个简单的解决方案,但是如何停止在旧的和已删除的文件中运行 VSCode 输出,并开始在工作文件/目录中运行新代码? I have cycled through every interpreter and run "print("...")" with the same result.我循环遍历了每个解释器并运行“print(”...”)”得到了相同的结果。 I have deleted all virtual environments using "sudo rm -rf venv" and still receive the same error - that there is a missing file or directory.我已经使用“sudo rm -rf venv”删除了所有虚拟环境,但仍然收到相同的错误 - 缺少文件或目录。 images provided below:下面提供的图像:

VSCode is [Running] a file I have deleted in Output - example 1 VSCode 是 [正在运行] 我在输出中删除的文件 -示例 1

/bin/sh: file or directory not found example 2 /bin/sh: 找不到文件或目录示例 2

I tried deleting all virtual environments, running the code in every available interpreter and searching every variation of this question to no avail.我尝试删除所有虚拟环境,在每个可用的解释器中运行代码并搜索此问题的每个变体,但均无济于事。

Inside of VSCode extension "Code Runner" the settings.JSON file needed to be debugged.在 VSCode 扩展“Code Runner”中,需要调试 settings.JSON 文件。 The initial curly braces were removed through some operation - and the output for python was: "python": "python -u";通过一些操作删除了最初的花括号 - python 的输出是:“python”:“python -u”; it needed to be changed to: "python": "python3";它需要更改为:“python”:“python3”; however the settings changes couldn't be implemented when changing the python output as the entire settings string was missing the first "{" braces - by deleting the entire settings list and leaving "{ }" the settings were reset, Code Runner extension was uninstalled automatically and upon installation, all settings were reloaded correctly (containing the initial curly braces that were missing) Then I was able to change: "python -u" to "python3" and the output finally showed the commands.然而,当更改 python 输出时无法实现设置更改,因为整个设置字符串缺少第一个“{”大括号 - 通过删除整个设置列表并保留“{}”设置被重置,Code Runner 扩展被卸载自动并在安装后,所有设置都正确重新加载(包含丢失的初始花括号)然后我能够更改:“python -u”到“python3”并且输出最终显示了命令。

Literal weeks to discover this answer and I tried everything.字面上几周来发现这个答案,我尝试了一切。

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

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