我通过/usr/local/bin/pip
执行sudo python3 -m pip install -U pip
命令强制启动了 pip。
现在我想使用 pip/usr/bin/pip
为了实现这一点,我已将 pip 重命名为/usr/local/bin/pip_backup
现在在我问,which pip
或者which pip -a
它只显示/usr/bin/pip
。
但我无法使用 pip 下载或安装任何软件包。它说
[root@localhost file_name]# pip install snips-nlu
-bash: /usr/local/bin/pip: No such file or directory
-------------------------------------------------------------------------
一些相关信息:
[root@localhost bot_v4.0]# which python -a
/usr/bin/python
[root@localhost bot_v4.0]# which pip -a
/usr/bin/pip
[root@localhost bot_v4.0]#
和这个:
[root@localhost bot_v4.0]# ll /usr/bin/pip*
-rwxr-xr-x. 1 root root 407 May 5 2018 /usr/bin/pip
lrwxrwxrwx. 1 root root 9 May 5 2018 /usr/bin/pip-2 -> ./pip-2.7
-rwxr-xr-x. 1 root root 407 May 5 2018 /usr/bin/pip2
lrwxrwxrwx. 1 root root 8 May 5 2018 /usr/bin/pip-2.7 -> ./pip2.7
-rwxr-xr-x. 1 root root 407 May 5 2018 /usr/bin/pip2.7
lrwxrwxrwx. 1 root root 9 May 5 2018 /usr/bin/pip-3 -> ./pip-3.6
lrwxrwxrwx. 1 root root 8 May 5 2018 /usr/bin/pip-3.6 -> ./pip3.6
-rwxr-xr-x. 1 root root 16184 Oct 18 15:38 /usr/bin/pipewire
和这个:
[root@localhost bot_v4.0]# ll /usr/local/bin/pip*
-rwxr-xr-x. 1 root root 223 Apr 4 10:25 /usr/local/bin/pip2
-rwxr-xr-x. 1 root root 223 Apr 4 10:25 /usr/local/bin/pip2.7
-rwxr-xr-x. 1 root root 216 Apr 3 17:05 /usr/local/bin/pip3
-rwxr-xr-x. 1 root root 216 Apr 3 17:05 /usr/local/bin/pip3.6
-rwxr-xr-x. 1 root root 223 Apr 4 10:25 /usr/local/bin/pip_bak
答案1
检查以下路线是否存在:
"$HOME/.local/bin"
如果是,请将以下内容添加到.bashrc
或.profile
:
if [ -d "$HOME/.local/bin" ];then
PATH="$HOME/.local/bin/:$PATH"
fi