pip3更新后install package出现ImportError: cannot import name 'main'
linux下pip3更新后,install包出现main不能导入的情况:
bear@bear:~/eclipse-workspace/Python-toolbox$ pip3 install pycryptodomex Traceback (most recent call last): File "/usr/bin/pip3", line 9, in <module> from pip import main ImportError: cannot import name 'main'
原因为pip更新为10.0.0后库里面的函数有所变动造成这个问题。
解决方案:
vim /usr/bin/pip3
# 更改前 from pip import main if __name__ == '__main__': sys.exit(main()) # 更改后 from pip import __main__ if __name__ == '__main__': sys.exit(__main__._main())
done !
Github地址:https://github.com/kumataahh