Bash中的PATH错误

时间:2013-09-03 19:40:20

标签: python linux bash path cx-freeze

我正在使用CentOS6 Bash并尝试使用Python& cx_Freeze。我不熟悉PATH和路径修改,这是服务器,我有点担心自己尝试(但我必须)。当我尝试$ cx_f / Freeze时,我得到-bash: cx_Freeze: command not found - 同样适用于任何cx_Freeze setup.py等,...尝试(包括module not found)。我的目标是使用cx_freeze(Python捆绑工具)。 Bash的o / p如下。

$ which python
  /usr/bin/python

$ sudo locate -b python | fgrep -w bin
[sudo] password for xyz: 

/usr/bin/abrt-action-analyze-python
/usr/bin/pip-python
/usr/bin/python
/usr/bin/python-config
/usr/bin/python-pip
/usr/bin/python2
/usr/bin/python2.6
/usr/bin/python2.6-config
/usr/local/cpanel/3rdparty/bin/python
/usr/local/cpanel/bin/ispythonversion2
/usr/local/cpanel/bin/ispythonversion2inbin

cx_Freeze显然位于/usr/lib/Python2.6/site-packages,由此o / p

证明
[xyz@server ~]$ ls
cpu  perl5  usr  xyz
[xyz@server ~]$ cd usr
[xyz@server usr]$ cd lib
[xyz@server lib]$ ls
python2.6
[xyz@server lib]$ cd python2.6
[xyz@server python2.6]$ ls
site-packages
[xyz@server python2.6]$ cd site-packages
[xyz@server site-packages]$ ls
cx_Freeze  cx_Freeze-4.3.1-py2.6.egg-info
[xyz@server site-packages]$ cd cx_Freeze
[xyz@server cx_Freeze]$ ls
bases     finder.py   freezer.pyc  hooks.pyo     initscripts  main.py   setupwriter.py   windist.py
dist.py   finder.pyc  freezer.pyo  __init__.py   macdist.py   main.pyc  setupwriter.pyc  windist.pyc
dist.pyc  finder.pyo  hooks.py     __init__.pyc  macdist.pyc  main.pyo  setupwriter.pyo  windist.pyo
dist.pyo  freezer.py  hooks.pyc    __init__.pyo  macdist.pyo  samples   util.so   

然后再说:

[xyz@server ~]$ ls
cpu  cpu.py  perl5  usr  xyz
[xyz@server ~]$ cd usr
[xyz@server usr]$ ls
bin  lib  share
[xyz@server usr]$ cd bin
[xyz@server bin]$ ls
cxfreeze  cxfreeze-quickstart
[xyz@server bin]$ cxfreeze-quickstart
-bash: cxfreeze-quickstart: command not found

所以,这让我对cx_Freeze安装的位置更加困惑!为了恶化事情,正如BM所说:“等等,还有更多!”

[xyzserver ~]$ sudo locate -b site-packages
[sudo] password for xyz: 
/usr/lib/python2.6/site-packages
/usr/lib64/python2.6/site-packages
/usr/share/xemacs/site-packages

为什么有这么多网站包。 / lib /和/ lib64 /中的内容有不同的内容,而/ lib /中的内容包含我需要的内容 - 尽管它们都没有cx_Freeze。

(我已经从上面的示例中删除了Python,site-packages结果,这些结果与我创建的virtualenv相对应,因为它是我理解的东西,可能使事情变得复杂。)

编辑:

[xyz@server ~]$ echo $PATH
/opt/apache-maven-3.0.5/bin:/home/vtripathi/perl5/bin:/usr/local/bin:/bin:/usr/bin:/usr/local  /sbin:/usr/sbin:/sbin:/home/vtripathi/bin

编辑-2.0:

[xyz@server ~]$ ls
cpu  cpu.py  perl5  usr  xyz
[xyz@server ~]$ cd usr
[xyz@server usr]$ cd bin
[xyz@server bin]$ ls
cxfreeze  cxfreeze-quickstart
[xyz@server bin]$ cd cxfreeze
-bash: cd: cxfreeze: Not a directory
[xyz@server bin]$ pwd
/home/xyz/usr/bin

EDIT-3.0:

[xyz@server ~]$ PATH=/usr/lib/python2.6
[xyz@server ~]$ $PATH
-bash: /usr/lib/python2.6: is a directory
[xyz@server ~]$ PATH=/usr/lib/
[xyz@server ~]$ $PATH
-bash: /usr/lib/: is a directory
[xyz@server ~]$ 

1 个答案:

答案 0 :(得分:0)

echo $PATH

那是〜/ usr / bin吗?或者cx_freeze的位置在哪里,你都不清楚