在使用pip安装软件包时,提示我的pip版本过低,并报错
root@ceph-admin:~# pip install ceph-deploy
Collecting ceph-deploy
Downloading https://files.pythonhosted.org/packages/1f/15/8dcbd2054670a8761d6484e588739cac5681e5661e9379862d121188b545/ceph-deploy-2.0.1.tar.gz (115kB)
100% |████████████████████████████████| 122kB 52kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named setuptools
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5IWWdl/ceph-deploy/
You are using pip version 8.1.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
于是乎,我先按照提示给pip升了个级,如下
root@ceph-admin:~# pip install --upgrade pip
然后重新安装软件,但是又出现报错
root@ceph-admin:~# pip install ceph-deploy
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
历经千辛万苦,在百度上找到了解决办法
root@ceph-admin:~# vim /usr/bin/pip
将 /usr/bin/pip 文件中:
from pip import main
if __name__ == '__main__':
sys.exit(main())
改为:
from pip import __main__
if __name__ == '__main__':
sys.exit(__main__._main())
然后信心满满的重新安装软件,但是没想到,又报错了
root@ceph-admin:~# pip install ceph-deploy
Collecting ceph-deploy
Using cached https://files.pythonhosted.org/packages/1f/15/8dcbd2054670a8761d6484e588739cac5681e5661e9379862d121188b545/ceph-deploy-2.0.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named setuptools
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-7neA7f/ceph-deploy/
又经历了久久八十一难,原来是缺少了一个叫setuptools==33.1.1的包,少啥就安啥
root@ceph-admin:~# pip install setuptools==33.1.1
成功后,再次安装目的包,成功
root@ceph-admin:~# pip install ceph-deploy
Collecting ceph-deploy
Using cached https://files.pythonhosted.org/packages/1f/15/8dcbd2054670a8761d6484e588739cac5681e5661e9379862d121188b545/ceph-deploy-2.0.1.tar.gz
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/dist-packages (from ceph-deploy) (33.1.1)
Installing collected packages: ceph-deploy
Running setup.py install for ceph-deploy ... done
Successfully installed ceph-deploy-2.0.1
并且pip版本也成功的升级了
root@ceph-admin:~# pip -V
pip 18.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)