centos7 python2和python3共存
ln -s /usr/local/python3/bin/python3 /usr/bin/python
# 测试
[root@operation bin]
# pip3 -V
pip 18.1 from
/usr/local/python3/lib/python3
.6
/site-packages/pip
(python 3.6)
# 使用
[root@operation bin]
# pip3 install 包名
或者
[root@operation bin]
# python3 -m pip install 包名
whereis python
/usr/bin/python
/usr/bin/python2.7
/usr/bin/python2.7-config
/usr/lib/python2.7
/usr/lib64/python2.7
/etc/python
/usr/include/python2.7
/usr/local/python3/bin/python3.8
/usr/local/python3/bin/python3.8-config
/root/miniconda3/bin/python
/root/miniconda3/bin/python2.7
/root/miniconda3/bin/python2.7-config
/usr/share/man/man1/python.1.gz
echo $PATH
/usr/local/python3//bin
:/home/software/cufflinks-2.1.1.Linux_x86_64/
:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre/bin
:/root/perl5/bin
:/root/miniconda3/bin
:/usr/local/python3//bin
:/home/software/cufflinks-2.1.1.Linux_x86_64/
:/usr/local/sbin
:/usr/local/bin
:/usr/sbin
:/usr/bin
:/root/bin
:/home/software/cuda-10.0/bin
which python
/root/miniconda3/bin/python
vi /usr/bin/yum
把
#!/usr/bin/python
修改为
#!/usr/bin/python2.7
同理
vi /usr/libexec/urlgrabber-ext-down
文件里面的
#!/usr/bin/python
也要修改为
#!/usr/bin/python2.7
which pip
/root/miniconda3/bin/pip
链接替换:
ln -s /usr/local/python3/bin/python3.8 /usr/bin/python -f
ln -s /usr/bin/pip3 /usr/bin/pip -f
# vim /usr/bin/firewall-cmd
首行改为
#!/usr/bin/python2.7 -Es