简体   繁体   English

故障排除-$ django-admin.py:找不到命令

[英]troubleshoot - $ django-admin.py: command not found

leavemealone:~ test$ django-admin.py startproject mysite
-bash: django-admin.py: command not found
leavemealone:~ test$ sudo ln -s /usr/local/lib/python2.6/dist-packages/django/bin/django-admin.py /usr/local/bin/django-admin.py
ln: /usr/local/bin/django-admin.py: File exists
leavemealone:~ test$ django-admin.py startproject.py
-bash: django-admin.py: command not found
leavemealone:~ test$ 

So, as a disclaimer, I might be an idiot. 因此,作为免责声明,我可能是个白痴。

I followed the install instructions on djangoproject.com, and followed their solution to the command not found error, yet it persists. 我按照djangoproject.com上的安装说明进行操作,并按照他们对命令未找到错误的解决方案进行操作,但该错误仍然存​​在。 I literally have no idea what to do at this point. 我现在不知道该怎么办。

Solution in comments, also was here https://docs.djangoproject.com/en/1.6/faq/troubleshooting/ . 评论中的解决方案,也位于https://docs.djangoproject.com/en/1.6/faq/troubleshooting/ Take care the files exists, the $PATH includes the path to django-admin.py , and the symlinks are correctly asigned 注意文件是否存在, $PATH包含django-admin.py的路径,并且符号链接已正确分配

If you don't want to set the $PATH , then you can just use one long command in Bash to start a new project. 如果您不想设置$PATH ,则可以在Bash使用一个长命令来启动一个新项目。 Like so: 像这样:

python ~/path/to/django-admin.py startproject <project_name>

A common path might be: 常见的路径可能是:

python ~/documents/virtualenvs/pay/lib/python2.7/site-packages/django/bin/django-admin.py startproject store

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

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