简体   繁体   English

django-admin.py在Powershell中无法正常工作

[英]django-admin.py not working properly in powershell

I'm new to Django, so this has been a learning process so far. 我是Django的新手,所以到目前为止,这是一个学习过程。 Basically, following the Django tutorial I tried to run django-admin.py startproject mysite and got this output . 基本上,按照Django教程,我尝试运行django-admin.py startproject mysite并获得此输出

If I try to run the command with py -3 or py I get this . 如果我尝试使用py -3py运行命令, py -3得到此信息

However, if I run django-admin.py startproject mysite in cmd it works. 但是,如果我在cmd中运行django-admin.py startproject mysite ,则可以正常运行。

Running the command with py -3 or py in cmd gives the same results as powershell. 在cmd中使用py -3py运行命令可获得与powershell相同的结果。 The kicker, for me anyway, is when I use the full filepath, py -3 (or just py) C:\\Python33\\Scripts\\django-admin.py startproject mysite , in powershell, it works... 无论如何,对我来说,最重要的是,当我使用完整的文件路径时, py -3 (or just py) C:\\Python33\\Scripts\\django-admin.py startproject mysite ,在powershell中,它可以工作...

My path includes the python script directory and I've set the .py file association. 我的路径包括python脚本目录,并且我已经设置了.py文件关联。 I'm only referencing the C:\\Python33\\Scripts directory in the path since I have both 2.7 and 3.3 installed currently. 我仅在路径中引用C:\\ Python33 \\ Scripts目录,因为当前同时安装了2.7和3.3。

I don't know why powershell won't cooperate with Django. 我不知道为什么Powershell无法与Django合作。

Edit: I am running Windows 8.1. 编辑:我正在运行Windows 8.1。

如果您已经将Scripts文件夹的文件路径添加到了Powershell中的环境变量中,并且添加了.py文件关联(听起来好像已经拥有了),那么实际上您就不需要.py了,因此,我只需要输入django-admin startproject mysite而不是django-admin.py startproject mysite即可。

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

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