美文网首页
python的坑

python的坑

作者: 书简的花果山 | 来源:发表于2018-04-27 16:46 被阅读184次

pip3更新的时候,可能会遇到提示main不能import的问题。

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

用了这个方法无效:
在github上开了一个issue,里面提到一个方案说原因是在hash缓存了旧的pip3,要使用新安装的需要清理hash,如下:

//bash
$ hash -d pip

//dash(sh)
$ hash -r pip

使用本条命令搞定:
sudo python3 -m pip uninstall pip && sudo apt install python3-pip --reinstall

相关文章

网友评论

      本文标题:python的坑

      本文链接:https://www.haomeiwen.com/subject/gucilftx.html