现象:安装pip后发现命令无法识别command not found
原因:which查看找到不到执行路径 find搜索发现安装后存放在/usr/local/python3.5/bin下,于是判断是因为没有注册路径的问题
解决:参考地址为https://lempstacker.com/tw/Installing-Python-3-5-on-CentOS-7/
http://blog.csdn.net/apn172/article/details/8868968
1、导出头文件: /usr/local/python3.5/include
2、导出库文件: /usr/local/python3.5/lib
3、为可执行程序添加PATH路徑: /usr/local/python3.5/bin
具体执行过程如下:
[[email protected] 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’ [[email protected] python3.5]$
[[email protected] 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 [[email protected] python3.5]$ cat /etc/ld.so.conf.d/python351.conf /usr/local/python3.5/lib [[email protected] 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
时间: 2024-11-08 07:36:41