windows django-admin.py startproject 打开记事本,而不是创建一个项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4679311/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:58:06  来源:igfitidea点击:

django-admin.py startproject opens notepad, instead of creating a project

windowsdjangocmd

提问by Marijus

Hey, so basically when I try to django-admin.py startproject mysite my notepad with django-admin.py file opens up instead of creating a new actual projects. I'm on windows and just yesterday I created the project and everything was fine.

嘿,所以基本上当我尝试 django-admin.py startproject mysite 时,我的带有 django-admin.py 文件的记事本会打开,而不是创建一个新的实际项目。我在 Windows 上,就在昨天我创建了这个项目,一切都很好。

采纳答案by sidhshar

Your python files would be associated to open with notepad. Change the behaviour to open with IDLE/python.

您的 python 文件将与记事本关联以打开。更改行为以使用 IDLE/python 打开。

回答by chefsmart

Instead of django-admin.py startproject mysitetry python django-admin.py startproject mysite

而不是django-admin.py startproject mysite尝试python django-admin.py startproject mysite

That should work, but...

那应该有效,但是...

...you will need to do something more if you want django-admin.py startproject mysiteto work without adding pythonat the start: -

...如果你想django-admin.py startproject mysite在不添加python的情况下工作,你需要做更多的事情:-

  1. right click any python file ending with the extension .py
  2. click on properties
  3. In the opens withsection, you should be able to see notepad. click on the changebutton next to this.
  4. click "browse" and locate your python.exe executable, most probably in c:\pythonxx\ directory then click on "open" then "ok"
  1. 右键单击以扩展名 .py 结尾的任何 python 文件
  2. 点击 properties
  3. 在该opens with部分中,您应该能够看到notepad. 单击change旁边的按钮。
  4. 单击“浏览”并找到您的 python.exe 可执行文件,最有可能在 c:\pythonxx\ 目录中,然后单击“打开”然后单击“确定”

That should set you up, or you can always revert back for clarifications.

这应该让您有所准备,或者您可以随时返回以进行澄清。

回答by Rusty

Another method: Instead of using django-admin.py write django-admin

另一种方法:而不是使用 django-admin.py 写 django-admin

django-admin startproject mysite

回答by anand24

When faced with an issue of django-admin.py opening in an editor

当遇到在编辑器中打开 django-admin.py 的问题时

I did this

我做了这个

Select python file and right click and set default open with python console for windows Problem will be solved automatically

选择python文件并右键单击并设置默认打开与windows的python控制台问题将自动解决