AttributeError: module 'pip' has no attribute 'main报错

  • 找到安装目录下 helpers/packaging_tool.py文件,找到如下代码:
    
    def do_install(pkgs):
    try:
    import pip
    except ImportError:
    error_no_pip()
    return pip.main(['install'] + pkgs) def do_uninstall(pkgs):
    try:
    import pip
    except ImportError:
    error_no_pip()
    return pip.main(['uninstall', '-y'] + pkgs)

    修改为如下,保存即可。

    def do_install(pkgs):
    try:
    # import pip
    try:
    from pip._internal import main
    except Exception:
    from pip import main
    except ImportError:
    error_no_pip()
    return main(['install'] + pkgs) def do_uninstall(pkgs):
    try:
    # import pip
    try:
    from pip._internal import main
    except Exception:
    from pip import main
    except ImportError:
    error_no_pip()
    return main(['uninstall', '-y'] + pkgs)


  • 在下载python库的时候,由于国内网络原因,python包的下载速度非常慢,查看pip 文档,只要在 pip的时候控制超时即可, 具体参数为 --default-timeout=100, 后面的时间可以自己指定。
  • 解决方法
  • pip --default-timeout=100 install gevent


python pip报错pip._ vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.的更多相关文章

  1. 解决pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

    参考链接[侵权删] https://www.jianshu.com/p/3378fa827924 https://yq.aliyun.com/articles/619208 问题描述:在Windows ...

  2. 错误:pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

    pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', ...

  3. pip安装超时问题-pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

    手动设置延时:(推荐) pip --default-timeout=100 install nibabel --或者不使用缓存pip  --no-cache-dir install Pillow 更改 ...

  4. 解决pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.问题

    国内的其他镜像源清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/阿里云 http://mirrors.aliyun.com/pypi/simple/中国科技 ...

  5. 安装SpaCy出现报错:requests.exceptions.ConnectionError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443):

    内含安装步骤及报错解决:https://www.cnblogs.com/xiaolan-Lin/p/13286885.html

  6. pip pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool

    设置超时时间: pip --default-timeout=100 install  Pillow

  7. python2.7使用requests时报错SSLError: HTTPSConnectionPool(host='b-ssl.duitang.com', port=443)

    import requests url='https://www.duitang.com/napi/blog/list/by_search/?kw=%E6%A0%A1%E8%8A%B1&sta ...

  8. 解决python爬虫requests.exceptions.SSLError: HTTPSConnectionPool(host='XXX', port=443)问题

    爬虫时报错如下: requests.exceptions.SSLError: HTTPSConnectionPool(host='某某某网站', port=443): Max retries exce ...

  9. 【Selenium】【BugList4】执行pip报错:Fatal error in launcher: Unable to create process using '""D:\Program Files\Python36\python.exe"" "D:\Program Files\Python36\Scripts\pip.exe" '

    环境信息: python版本:V3.6.4 安装路径:D:\Program Files\python36 环境变量PATH:D:\Program Files\Python36;D:\Program F ...

随机推荐

  1. WinForm的RadioButton使用小技巧

    http://www.cnblogs.com/sjrhero/articles/1883155.html 当多个RadioButton同在一个容器里面的时候,多半的操作都是要得到其中一个的值这个时候我 ...

  2. 攻防世界--The_Maya_Society

    测试文件:https://adworld.xctf.org.cn/media/task/attachments/17574fc423474b93a0e6e6a6e583e003.zip 我们直接将Li ...

  3. C++多态下的访问修饰符

    C++多态下的访问修饰符 先上代码: class Parent { public: virtual void showMsg() { cout << "Parent showMs ...

  4. Gos: Armed Golang 💪

    Gos: Armed Golang

  5. 帝国CMS 调用专题[eshowzt]标签改为灵动标签[e:loop]的方法

    1.eshowzt说明及示例 [eshowzt]标签模板ID,专题类别ID,显示专题数[/eshowzt] 示例需求:将推荐专题后,显示9个指定专题 原来写法: <span>[eshowz ...

  6. JMETER - BEANSHELL获取响应结果

    获取响应结果 添加后置处理器     //获取获取请求的返回值 String response = prev.getResponseDataAsString(); //日志打印获取请求的返回值 log ...

  7. Linux 部署或升级openssh7.5p1

    运维Linux系统,部署或升级openssh是经常面临的事,以下已redhat6和redhat7为例. 在redhat6中部署openssh会有什么坑,在编辑openssh源码包时会报一些类似的错误, ...

  8. simrank python实现

    1.数据 pc,hp.com pc,hp.com pc,hp.com pc,hp.com pc,hp.com pc,hp.com pc,hp.com pc,hp.com pc,hp.com pc,hp ...

  9. linux下命令行执行Python程序提示no moudle,路径问题

    在ide中执行python程序,已经设置好项目路径中. 但是在cmd中执行程序,所在路径是python的搜索路径,如果涉及到import引用就会报类似ImportError: No module na ...

  10. [洛谷P1514] NOIP2010 引水入城

    问题描述 在一个遥远的国度,一侧是风景秀美的湖泊,另一侧则是漫无边际的沙漠.该国的行政区划十分特殊,刚好构成一个N 行×M 列的矩形,如上图所示,其中每个格子都代表一座城市,每座城市都有一个海拔高度. ...