linux|ubuntu16.04输入pipenv CommandNotFound

阿里云
16.04
某同事新安装的系统
需要python环境隔离,输入pipenv
提示:CommandNotFound
这个比较奇怪了,一般如果说命令不存在,应该提示:command not found

网上查,有个哥们儿说,自己在系统里新装了一个python3.7之后也出现了类似的情况.问同事是不是也这么干过,果然,说之前需要3.6以上的python也手动装过一个3.7.
网上的解决方案:

sudo apt-get remove --purge python3*
sudo apt auto remove

我自然本能觉得不能这么看.
查看了一下python的软链

ls -lh /usr/bin/python*
lrwxrwxrwx 1 root root    9 Nov 24  2017 /usr/bin/python -> python2.7
lrwxrwxrwx 1 root root    9 Nov 24  2017 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 3.4M Dec  5  2017 /usr/bin/python2.7
lrwxrwxrwx 1 root root   33 Dec  5  2017 /usr/bin/python2.7-config -> x86_64-linux-gnu-python2.7-config
lrwxrwxrwx 1 root root   16 Nov 24  2017 /usr/bin/python2-config -> python2.7-config
lrwxrwxrwx 1 root root    9 Aug 17  2017 /usr/bin/python3 -> python3.5
-rwxr-xr-x 2 root root 4.3M Nov 29  2017 /usr/bin/python3.5
lrwxrwxrwx 1 root root   33 Nov 29  2017 /usr/bin/python3.5-config -> x86_64-linux-gnu-python3.5-config
-rwxr-xr-x 2 root root 4.3M Nov 29  2017 /usr/bin/python3.5m
lrwxrwxrwx 1 root root   34 Nov 29  2017 /usr/bin/python3.5m-config -> x86_64-linux-gnu-python3.5m-config
lrwxrwxrwx 1 root root   24 Mar 19  2019 /usr/bin/python3.6 -> /usr/local/bin/python3.6
lrwxrwxrwx 1 root root   16 Mar 23  2016 /usr/bin/python3-config -> python3.5-config
lrwxrwxrwx 1 root root   10 Aug 17  2017 /usr/bin/python3m -> python3.5m
lrwxrwxrwx 1 root root   17 Mar 23  2016 /usr/bin/python3m-config -> python3.5m-config
lrwxrwxrwx 1 root root   16 Nov 24  2017 /usr/bin/python-config -> python2.7-config

发现正确的python3是指向当前目录的python3.5
而有问题的这台机器的python3是批向了
/usr/local/bin/python3.7

直接将这个软链修改正确,问题解决.


相关博文

About rainbird

IOS攻城狮
This entry was posted in linux and tagged , , , , , , , . Bookmark the permalink.

发表评论