简体   繁体   English

当我将“.py”扩展名与 CMD 命令一起使用时,VSCode 会启动

[英]VSCode starts up when I use “.py” extension with CMD commands

I don't know when and how it started but now I have such a glitch:我不知道它何时以及如何开始,但现在我遇到了这样的小故障:

  1. open CMD打开CMD
  2. enter python command: "django-admin.py help"输入python命令:“django-admin.py help”
  3. Visual Studio Code starts up and opens manage.py for editing. Visual Studio Code 启动并打开 manage.py 进行编辑。
  4. The CMD command itself does not return anything. CMD 命令本身不返回任何内容。

  5. on the other hand, if I enter: "django-admin help" (without .py) the CMD shows help and VSCODE does not react in any way.另一方面,如果我输入:“django-admin help”(没有 .py),CMD 会显示帮助并且 VSCODE 不会以任何方式做出反应。

What is this magic?这是什么魔法? How to change VSCODE reaction to .py mentioning?如何将 VSCODE 反应更改为 .py 提及?

它也发生在我身上,我尝试使用django-admin.py startproject example创建一个 django 项目,我四处询问,我发现 django-admin.py 在 Windows 的django-admin.py上不起作用(我不太确定 mac) ,vscode 将其视为文件而不是命令,因为 vscode 不需要 .py 扩展名来执行命令。

i just had the same issue.我只是有同样的问题。 I noticed that after i installed pylint on VS Code, i couldn't access the manage.py from CMD.我注意到在 VS Code 上安装 pylint 后,我​​无法从 CMD 访问 manage.py。 It seemed as though now my system was trying to open the .py with VS code instead of executing it with Python.似乎现在我的系统正在尝试使用 VS 代码打开 .py,而不是使用 Python 执行它。 So i opened the windows file explorer and right clicked on the manage.py icon and clicked on "Open With >> Python" .所以我打开了 Windows 文件资源管理器,右键单击 manage.py 图标,然后单击“打开方式 >> Python”。 After that , I was able to start up the app again as usually在那之后,我能够像往常一样再次启动该应用程序在此处输入图片说明

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

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