查看 python -V 报错 -bash: /usr/bin/python: No such file or directory

时间:2024-04-03 12:57:22

 清除历史python之后,指向我安装的版本3.8.2之后,查看python版本,报错

 python -V

 查看 python -V 报错 -bash: /usr/bin/python: No such file or directory

一直报错:

报错信息:-bash: /usr/bin/python: No such file or directory

进到 cd /usr/bin 目录下,看下指向是没问题

 查看 python -V 报错 -bash: /usr/bin/python: No such file or directory

 

才发现,其实whereis python已经列出来了版本及对应目录

 查看 python -V 报错 -bash: /usr/bin/python: No such file or directory

 查看 python -V 报错 -bash: /usr/bin/python: No such file or directory

重新清除python软链

rm -rf /usr/bin/python

重新指向软链(注意这里是/usr/local/bin目录,不是/usr/bin,不要搞混了)

ln -s /usr/local/bin/python3.8 /usr/bin/python   #这里要注意,不要用成了ln -s /usr/bin/python3.8 /usr/bin/python

 查看 python -V 报错 -bash: /usr/bin/python: No such file or directory