現象:安裝pip後發現命令沒法識別command not foundpython
緣由:which查看找到不到執行路徑 find搜索發現安裝後存放在/usr/local/python3.5/bin下,因而判斷是由於沒有註冊路徑的問題spa
解決:參考地址爲https://lempstacker.com/tw/Installing-Python-3-5-on-CentOS-7/.net
http://blog.csdn.net/apn172/article/details/8868968code
一、導出頭文件: /usr/local/python3.5/include
blog
二、導出庫文件: /usr/local/python3.5/lib
ip
三、爲可執行程序添加PATH路徑: /usr/local/python3.5/bin
pip
具體執行過程以下:class
[flying@lemp python3.5]$ sudo ln -sv /usr/local/python3.5/include /usr/local/include/python3 #若是採用的是root帳戶就能夠不加sudo ln爲添加軟連接 ‘/usr/local/include/python3/include’ -> ‘/usr/local/python3.5/include’ [flying@lemp python3.5]$
[flying@lemp python3.5]$ echo '/usr/local/python3.5/lib' | sudo tee /etc/ld.so.conf.d/python351.conf #tee重定向文件,把python3.5的庫文件路徑寫入python351.conf而後放在/etc/ld.so.conf.d下 /usr/local/python3.5/lib [flying@lemp python3.5]$ cat /etc/ld.so.conf.d/python351.conf /usr/local/python3.5/lib [flying@lemp python3.5]$ sudo ldconfig -v
echo 'export PATH=$PATH:/usr/local/python3.5/bin' | sudo tee /etc/profile.d/python351.sh #添加環境變量 #使文件生效 source /etc/profile.d/python351.sh