python2和python3共存方法

拿到安裝包,安裝python3python

centos: ubuntu

sudo yum install python36

ubuntu:centos

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6

 

安裝pip並升級到最新版本:python2.7

python -m pip install --upgrade pip

python3 -m pip install --upgrade pip

 

 

若是發現python3安裝沒有帶pip:spa

 

python3 -m ensurepip

 

 

檢查python2和python3是否分開:code

pip -V

pip 19.2.1 from /usr/lib/python2.7/site-packages/pip (python 2.7)blog

pip3 -V

 

pip 19.2.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)ip

 

升級pip後,找不到pip:get

whereis pip

使用軟連接:it

sudo ln -s /usr/bin/pip2.7  /usr/bin/pip
相關文章
相關標籤/搜索