參考:https://blog.csdn.net/nnewbie/article/details/80100533 python
今天使用pip的時候報錯,不肯定是什麼緣由,網上說是pip的bug,試一下才能肯定,pip版本: 10.0.1bash
[root@133 ~]# pip Traceback (most recent call last): File "/usr/bin/pip", line 7, in <module> from pip import main ImportError: cannot import name main
修改/usr/bin/pip文件中python2.7
from pip import main if __name__ == '__main__': sys.exit(main())
改爲ide
from pip import __main__ if __name__ == '__main__': sys.exit(__main__._main())
能夠解決這個bugspa
[root@133 ~]# pip -V pip 10.0.1 from /opt/amos/python2.7/lib/python2.7/site-packages/pip (python 2.7)