pip 解决 ImportError: cannot import name 'main'
当 pip 更新至最新版的时候,不管是执行 pip list 还说 pip install packageName 安装包,都会抛出一个异常
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module> from pip import main ImportError: cannot import name 'main'
那么应该怎么解决呢,其实很简单, 编辑 /usr/bin/pip
文件,修改代码
from pip._internal import main
Not able to pip install pickle in python 3.6
pickle
module is part of the standard library in Python for a very long time now so there is no need to install it via pip
. I wonder if you IDE or command line is not messed up somehow so that it does not find python installation path. Please check if your %PATH%
contains a path to python (e.g. C:\Python36\
or something similar) or if your IDE correctly detects root path where Python is installed.
或者安装
You can pip install pickle by running command pip install pickle-mixin
. Proceed to import it using import pickle
. This can be then used normally.
import tqdm
安装失败,那就多试试这几个镜像
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tqdm
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/
note:新版ubuntu要求使用https源,要注意。