Linux 故障执行器';正在删除已知已安装的可执行文件
我最近在Arch系统上安装了PyQt4和PyQt5,但当我在终端中运行“qmlviewer”时,它返回:Linux 故障执行器';正在删除已知已安装的可执行文件,linux,command-line,pyqt,qml,Linux,Command Line,Pyqt,Qml,我最近在Arch系统上安装了PyQt4和PyQt5,但当我在终端中运行“qmlviewer”时,它返回: qmlviewer: could not exec '/usr/lib/qt/bin/qmlviewer': No such file. 我知道我有qmlviewer--alocate返回我有qmlviewer的几个目录。它只是不在我的终端正在执行的目录中。如何让我的终端尝试从它实际所在的目录中执行qmlviewer?bash跟踪命令的位置。(否则每次都必须搜索路径。)当可执行文件被移动时
qmlviewer: could not exec '/usr/lib/qt/bin/qmlviewer': No such file.
我知道我有qmlviewer--a
locate
返回我有qmlviewer的几个目录。它只是不在我的终端正在执行的目录中。如何让我的终端尝试从它实际所在的目录中执行qmlviewer?bash
跟踪命令的位置。(否则每次都必须搜索路径。)当可执行文件被移动时(如升级过程中可能发生的情况),shell将不知道其路径信息已过期。解决方案是运行hash-r
,清除shell内存中的路径位置。下次尝试运行可执行文件时,bash
将从头开始搜索路径以找到它
一个小小的示范将使这一切付诸实施。让我们创建一个名为cmd1
的新命令:
# cp /bin/date /bin/cmd1
# cmd1
Tue Mar 18 22:27:23 PDT 2014
bash
必须搜索路径以查找cmd1
,但一旦搜索完成,它就会记住,正如type
命令所示:
# type cmd1
cmd1 is hashed (/bin/cmd1)
现在,让我们通过移动命令来欺骗bash
:
# mv /bin/cmd1 /usr/bin/cmd1
# cmd1
bash: /bin/cmd1: No such file or directory
以下是解决方案:
# hash -r
# cmd1
Tue Mar 18 22:28:20 PDT 2014
# type cmd1
cmd1 is hashed (/usr/bin/cmd1)
manbash
的相关部分是:
中包含了一个功能稍差的
哈希
函数版本。在最近的安装之前,qmlviewer是否可能在该目录中?如果是这样,bash
可能已将该位置保存在其缓存中。要清除缓存以便下次搜索路径,请运行hash-r
。有关详细信息,请参见manbash
。
hash -rv command ...
The shell maintains a hash table which remembers the loca‐
tions of commands. With no arguments whatsoever, the hash
command prints out the contents of this table. Entries
which have not been looked at since the last cd command
are marked with an asterisk; it is possible for these
entries to be invalid.
With arguments, the hash command removes the specified
commands from the hash table (unless they are functions)
and then locates them. With the -v option, hash prints
the locations of the commands as it finds them. The -r
option causes the hash command to delete all the entries
in the hash table except for functions.