在以前的文章centos雲服務器安裝Python3記錄 記錄了怎麼自定義安裝 Python3 ,在後邊測試pip3的時候發現了個問題:python
pip --version
terminal 打印:git
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
如上:pip版本仍是 Python2.7 版本shell
因爲對於系統和Python並非特別熟悉,首先想到的是問下度娘。度娘給了幾種建議所有是下載pip再安裝。我沒有急於執行而是去看了下 官方文檔
其中有這樣的表述:centos
大概意思是:bash
[root@liuyonghu python3]# pip --version pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
[root@liuyonghu python3]# python -m ensurepip --default-pip Looking in links: /tmp/tmpzzl1ppca Requirement already satisfied: setuptools in ./lib/python3.7/site-packages (39.0.1) Requirement already satisfied: pip in ./lib/python3.7/site-packages (10.0.1)
[root@liuyonghu bin]# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3 [root@liuyonghu bin]# pip3 --version pip 10.0.1 from /usr/local/python3/lib/python3.7/site-packages/pip (python 3.7)
Last login: Sat Sep 29 23:13:21 on ttys002 liuyonghudeMacBook-Pro:~ liuyonghu$ pip3 --version pip 9.0.1 from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (python 3.6) liuyonghudeMacBook-Pro:~ liuyonghu$ which python3 /usr/local/bin/python3 liuyonghudeMacBook-Pro:~ liuyonghu$ which pip3 /usr/local/bin/pip3 liuyonghudeMacBook-Pro:~ liuyonghu$ ln -s /Library/Frameworks/Python.framework/Versions/3.6/bin/pip3 /usr/local/bin/pip liuyonghudeMacBook-Pro:~ liuyonghu$ pip --version pip 9.0.1 from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (python 3.6)
[root@liuyonghu python3]# pip --version pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7) [root@liuyonghu python3]# python -m ensurepip --default-pip Looking in links: /tmp/tmpzzl1ppca Requirement already satisfied: setuptools in ./lib/python3.7/site-packages (39.0.1) Requirement already satisfied: pip in ./lib/python3.7/site-packages (10.0.1) [root@liuyonghu python3]# cd /user/bin -bash: cd: /user/bin: 沒有那個文件或目錄 [root@liuyonghu python3]# cd /usr/bin [root@liuyonghu bin]# ls pip* pip pip2 pip2.7 [root@liuyonghu bin]# mv pip pip.bak [root@liuyonghu bin]# cd ./lib/python3.7/site-packages (10.0.1) -bash: 未預期的符號 `(' 附近有語法錯誤 [root@liuyonghu bin]# cd usr/lib/python3.7/site-packages (10.0.1) -bash: 未預期的符號 `(' 附近有語法錯誤 [root@liuyonghu bin]# cd usr/lib/python3.7/site-packages -bash: cd: usr/lib/python3.7/site-packages: 沒有那個文件或目錄 [root@liuyonghu bin]# mv pip.bak pip [root@liuyonghu bin]# ls pip* pip pip2 pip2.7 [root@liuyonghu bin]# cd usr/lib/python3.7 -bash: cd: usr/lib/python3.7: 沒有那個文件或目錄 [root@liuyonghu bin]# cd usr/local/python3 -bash: cd: usr/local/python3: 沒有那個文件或目錄 [root@liuyonghu bin]# cd /usr/lib/python3.7 -bash: cd: /usr/lib/python3.7: 沒有那個文件或目錄 [root@liuyonghu bin]# cd /usr/local [root@liuyonghu local]# cd python3 [root@liuyonghu python3]# ls pip* ls: 沒法訪問pip*: 沒有那個文件或目錄 [root@liuyonghu python3]# ls bin include lib share [root@liuyonghu python3]# cd lib [root@liuyonghu lib]# cd lib -bash: cd: lib: 沒有那個文件或目錄 [root@liuyonghu lib]# ls pip* ls: 沒法訪問pip*: 沒有那個文件或目錄 [root@liuyonghu lib]# cd .. [root@liuyonghu python3]# cd bin [root@liuyonghu bin]# ls pip* pip3 pip3.7 [root@liuyonghu bin]# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3 [root@liuyonghu bin]# pip3 --version pip 10.0.1 from /usr/local/python3/lib/python3.7/site-packages/pip (python 3.7)
1.Python3 在解壓,在預約目錄,編譯安裝以後,生成了Python、pip的執行文件。服務器
2.在系統中的指令存在於不一樣系統的 /usr/*/bin/ 文件夾中,若有須要能夠本身去創建軟鏈。python2.7