Traceback (most recent call last): File "/usr/bin/pip3", line 9, in <module> from pip impor…

  • 2019 年 10 月 10 日
  • 筆記

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U  pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

python3设置默认源时报错

Traceback (most recent call last):    File "/usr/bin/pip3", line 9, in <module>      from pip import main  ImportError: cannot import name 'main'

输入命令

sudo /usr/bin/pip3

from pip import main  if __name__ == '__main__':      sys.exit(main())

改为

from pip import __main__  if __name__ == '__main__':      sys.exit(__main__._main())