系统是centos7 64位,在命令行下安装python3.4.3(之前版本是python2.7.5),安装后一切正常,修改系统的python版本链接后能显示出python3.4.3这个版本号,用"python"命令也能进入python的解释器状态
但是当我安装pip工具后就开始出现只能查版本号,键入"python"提示command not found的情况.(pip安装也不成功)
有没有哪位遇到过这种问题?要怎么解决?为什么会这样?
怪我咯2017-04-17 16:54:52
1. First check where the current python bin file is? (There should be 2, the 2.7.5 that comes with the system and the one you installed)
whereis python
2. Then write the path of the python bin file of version 3.4.3 you installed into the environment variable
假如你安装在/application/python里,source是重新加载这文件(此文件开机会自动执行)
echo 'export PATH=/application/python/bin:$PATH' >> /etc/profile
source /etc/profile
Similar to pip, it is probably also an environment variable problem. The original python2 is being called. Just add PATH to the environment variable.
伊谢尔伦2017-04-17 16:54:52
You should pay attention to whether the PIP you use is python2, try using pip3. You can directly use python3's pip to create a soft link under /usr/local/bin.
怪我咯2017-04-17 16:54:52
It is best not to directly overwrite the old version of python, otherwise your yum will not be usable. Experience it firsthand
阿神2017-04-17 16:54:52
There is only python3 in you $PATH.you may hav deleted the default Python bin link.