Linux pip command error -bash: pip: command not found-ImportError: No module named XXX
A, Linux pip command error -bash: pip: command not found
$ wget https://bootstrap.pypa.io/get-pip.py # 下载
$ python get-pip.py # 安装
$ pip -V # 查看版本
find / -name pip # 查看安装路径:
ln -sv /usr/local/python/bin/pip /usr/bin/pip # 软连接
If you need to re-install the python configuration environment variable
export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH=$HOME/bin:/usr/local/python27/bin:/usr/local/bin:$PATH
Source command execution, update PATH.
source .zshrc
二、ImportError:No module named XXX
The following solution is after you've installed the module, the solution to problem.
shell running python program error, suggesting ImportError: No module named schedule
input the output of the shell python python python 2.7.5 version is
it / root / anaconda / bin / python exist in the system
outputs a two scenarios in sys. path
shell:
[user@localhost ~]$ python
Python 2.7.5 (default,Aug 7 2009, 18:39:16)
[GCC 4.8.5 20151604 (Red Hat 4.8.5-44)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import sys
>>> print sys.path
['','/usr/local/lib64/python27.zip','/usr/local/lib64/python2.7',
'/usr/local/lib64/python2.7/plat-linux2', '/usr/local/lib64/python2.7/lib-tk',
'/usr/local/lib64/python2.7/lib-old', '/usr/local/lib64/python2.7/lib-dynload',
'/usr/lib/python2.7/site-packages']
Then study a little sys.patch GENERATION:
.. A List of strings that specifies at The Search path for modules at The Environment variable Initialized from PYTHONPATH, PLUS AN installation-dependent default
this is not only a relationship with the PYTHONPATH, and the installation-dependent default relationship, this relationship is estimated that the mounting of the python, and the installation of two machines python2.4 and 2.6 sys.path output by the above discovery,
So the problem has been resolved, use the script
/usr/bin/python XXX.py
rather than python XXX.py
the XXX.py or modify executable files, add the following in python head
#!/usr/bin/python
python running in the background
https://www.jb51.net/article/156969.htm