Django-admin.py not working (-bash:django-admin.py: command not found)

倾然丶 夕夏残阳落幕 提交于 2019-12-10 18:47:00

问题


I'm having trouble getting django-admin.py to work... it's in this first location: /Users/mycomp/bin/ but I think I need it in another location for the terminal to recognize it, no?

Noob, Please help. Thanks!!

my-computer:~/Django-1.1.1 mycomp$ sudo ln -s /Users/mycomp/bin/django-admin.py /Users/mycomp/django-1.1.1/django-admin.py
Password:
ln: /Users/mycomp/django-1.1.1/django-admin.py: File exists
my-computer:~/Django-1.1.1 mycomp$ django-admin.py --version
-bash: django-admin.py: command not found

回答1:


you need to export /Users/mycomp/bin to environment variable PATH

for a session

export PATH=/Users/mycomp/bin:$PATH

for permanent, whenever you use bash

echo "export PATH=/Users/mycomp/bin:\$PATH" >> ~/.bashrc
source ~/.bashrc

Note: And I think django automatically create executable django-admin file in the bin folder (notice there is no extensions .py) when you installed, So you should try django-admin only too.



来源:https://stackoverflow.com/questions/2687704/django-admin-py-not-working-bashdjango-admin-py-command-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!