2

挣扎了6个多小时后,我决定寻求帮助。

使命:借助 Django
工具创建项目:Windows Vista、Putty SSH
位置:Bluehost (www.bluehost.com) 服务器

我已经阅读了有关同一问题的这些主题:

  1. -bash:django-admin.py:找不到命令(Django 安装)
  2. 无法使用 django-admin.py
  3. Django:新建项目时,弹出“django-admin.py: command not found”错误
  4. django-admin.py:找不到命令
  5. 找不到命令:django-admin.py
  6. Django-admin.py 不工作(-bash:django-admin.py:找不到命令)

我已经按照此处的说明安装了 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*

问题:当我尝试创建我的项目时,我看到了这个错误:

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
./  ../

所以我读了很多关于PATH的内容,但我无法让它工作。我应该放弃吗?

4

2 回答 2

2

将您的 PATH 条目修改.bashrc为如下所示:

export PATH=$HOME/Django-1.5/bin/:$HOME/.local/bin:$HOME/.local/usr/bin:$PATH

并通过执行以下操作重新加载您.bashrc的:

# . ~/.bashrc
于 2013-03-28T00:10:01.577 回答
1

将 django 路径添加到您的$PATH.

把你~/.bashrc改成

# .bashrc
export PATH=$HOME/.local/bin:$HOME/.local/usr/bin:$HOME/Django-1.5/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
~
~
于 2013-03-28T00:10:20.093 回答