简体   繁体   中英

Django-Admin.py in Powershell

I think I'm encountering a weird bug in Windows 8.1 trying to use django-admin.py (and any script really) in Powershell. I've successfully installed Python 2.7.6, and have added C:\\Python27\\ and C:\\Python27\\Scripts to my path.

When I try to use django-admin.py or python django-admin.py in Powershell, I get a file not found error.

Interestingly, when I use Command Prompt, I am able to use django-admin.py , even without the python prefix.

To execute scripts in Powershell, you need to set the execution policy to something other than restricted. For example:

Set-ExecutionPolicy RemoteSigned

This should allow general scripts (like .ps1 files) to be run. I still had problems running python files from the path so I added .py files to the PATHEXT variable. In Powershell:

$env:PATHEXT += ";.py"

I don't think this is permanent, so you may need to add it to your profile or change the environmental variables from the Advanced System Settings. This fixed the problem for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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