django-admin.py:找不到命令(bluehost 服务器)

问题描述

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

After struggling more than 6 hours, I decided to ask for help.

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

Mission: To create a project with the help of Django
Tools: Windows Vista, Putty SSH
Location: Bluehost (www.bluehost.com) Server

我已经阅读过关于同一个问题的这些主题:

  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: 找不到命令)

我已按照此处的说明(Bluehost 帮助页面)安装了 Python:
https://my.bluehost.com/cgi/help/python-install

I have installed Python as explained here (Bluehost Help Page):
https://my.bluehost.com/cgi/help/python-install

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的情况下再次尝试,我看到了这个错误:

Then I have tried again without .py, I see this error:

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 的内容,但我无法让它发挥作用.我应该放弃吗?

So I read a lot about the PATH, but I could not make it work. Should I give up?


解决方案

修改你的 .bashrc PATH 条目,如下所示:

Modify your .bashrc PATH entry to look like:

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

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

And reload your .bashrc by doing:

# . ~/.bashrc

相关文章