0

我正在使用 CentOS6 Bash 并尝试使用 Python 和 cx_Freeze。我不熟悉 PATH 和 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

编辑-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 ~]$ 
4

1 回答 1

0
echo $PATH

~/usr/bin 在那里吗?或者 cx_freeze 的位置在哪里,你不澄清

于 2013-09-03T19:45:47.260 回答