gpt4 book ai didi

python - Bash 中的路径错误

转载 作者:太空宇宙 更新时间:2023-11-04 04:12:11 26 4
gpt4 key购买 nike

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

$ 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。

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

编辑:

[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 ~]$

最佳答案

echo $PATH

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

关于python - Bash 中的路径错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18600214/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com