python, python3, pip, pip3 的说明

20230215

python: 打开系统当前情况下默认command中的python
python3: 打开python 3的版本

pip: 默认安装在系统当前情况下默认command中的python
pip3: 安装python3的pip 包

(base) xli:~$ python
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
(base) xli:~$ which python
/home/xli/anaconda3/bin/python
(base) xli:~$ sudo which python
[sudo] password for xli:
/usr/bin/python
(base) xli:~$ sudo python
Python 2.7.15+ (default, Oct  7 2019, 17:39:04)
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

如何判断当前的python环境:

echo $PATH
which python
which python2
ls -l /usr/bin/python
ls -l /usr/bin/python2  
ls -l /usr/bin/python2.7
which python3    
ls -l /usr/bin/python3
ls -l /usr/bin/python3.7
ls -l /usr/bin/python*

参考:
[1] https://stackoverflow.com/questions/5846167/how-to-change-default-python-version

posted @ 2023-02-15 12:53  xiaoxuxli  阅读(58)  评论(0编辑  收藏  举报