经过6个多小时的挣扎,我决定寻求帮助 .
使命:在Django的帮助下创建项目
工具:Windows Vista,Putty SSH
位置:Bluehost(www.bluehost.com)服务器
I have already read these topics about the same question:
-
-bash: django-admin.py: command not found (Django Installation)
-
Django: When creating a new project, “django-admin.py: command not found” Error pops up
-
Django-admin.py not working (-bash:django-admin.py: command not found)
我按照此处的说明安装了Python(Bluehost帮助页面):
https://my.bluehost.com/cgi/help/python-install
安装并检查了
Python 2.7.2,它看起来像:
username@domain.com [~/python]# ls
./ ../ Python-2.7.2/ Python-2.7.2.tgz bin/ include/ lib/ share/
目录 ~/python/Python-2.7.2/ 看起来像这样:
username@domain.com [~/python/Python-2.7.2]# ls
./ LICENSE Objects/ build/ pyconfig.h.in
../ Lib/ PC/ config.log python*
.hg_archival.txt Mac/ PCbuild/ config.status* python-gdb.py
.hgtags Makefile Parser/ configure* setup.py
Demo/ Makefile.pre Python/ configure.in
Doc/ Makefile.pre.in README install-sh*
Grammar/ Misc/ RISCOS/ libpython2.7.a
Include/ Modules/ Tools/ pyconfig.h
和 ~/python/bin/ 看起来像这样:
username@domain.com [~/python/bin]# ls
./ 2to3* idle* python* python2.7* smtpd.py*
../ django-admin.py* pydoc* python-config@ python2.7-config*
安装并检查了
Django 1.5,它看起来像:
username@domain.com [~/Django-1.5]# ls
./ AUTHORS LICENSE PKG-INFO build/ docs/ scripts/ setup.py
../ INSTALL MANIFEST.in README.rst django/ extras/ setup.cfg tests/
和 ~/Django-1.5/bin/ 看起来像这样:
username@domain.com [~/Django-1.5/django/bin]# ls
./ __init__.py django-2to3.py* profiling/
../ daily_cleanup.py* django-admin.py* unique-messages.py*
Problem: When I try to create my project, I see this error:
username@domain.com [~/www/domain/]# django-admin.py startproject mysite
-bash: django-admin.py: command not found
然后我再次尝试没有.py,我看到这个错误:
username@domain.com [~/www/domain/]# django-admin.py startproject mysite
-bash: django-admin.py: command not found
~ / .bashrc看起来像这样:
# .bashrc
export PATH=$HOME/.local/bin:$HOME/.local/usr/bin:$PATH
#User specific aliases and functions
alias mv='mv -i'
alias rm='rm -i'
alias cp='cp -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
~
~
~ / bin /看起来像这样:
username@domain.com [~/bin]# ls
./ ../
So I read a lot about the PATH, but I could not make it work. Should I give up?
2 回答
修改您的
.bashrc
PATH条目,如下所示:并通过执行以下操作重新加载
.bashrc
:将django路径添加到
$PATH
.改变你
~/.bashrc