解决'django-admin' 不是内部或外部命令错误
The error message 'django-admin' is not recognized as an internal or external command, program, or batch file suggests that Django is not properly installed or added to the system's PATH environment variable. To resolve this issue, you need to ensure that Django is properly installed and added to the system's PATH environment variable.
Here are a few steps you can follow to fix the problem:
-
Make sure you have Django installed. You can check by running the command
python -m django --versionin the command prompt. If Django is not installed, you can install it using the commandpip install django. -
Once Django is installed, you need to add it to the system's PATH environment variable. Here's how you can do it:
- Open the Start menu and search for 'Environment Variables'.
- Click on 'Edit the system environment variables'.
- In the System Properties window, click on the 'Environment Variables' button.
- In the 'System variables' section, scroll down and find the 'Path' variable. Select it and click on the 'Edit' button.
- In the 'Edit Environment Variable' window, click on the 'New' button and add the path to your Django installation. It is usually something like 'C:\PythonXX\Scripts' or 'C:\PythonXX\Scripts\django\bin' (replace 'XX' with the version of Python you are using).
- Click 'OK' to save the changes.
-
After adding Django to the PATH, close the command prompt and open a new one. Then try running the
django-admincommand again.
If you still encounter the same error, you may need to check if Django was installed correctly or consider reinstalling it.
原文地址: https://www.cveoy.top/t/topic/ph2M 著作权归作者所有。请勿转载和采集!