zoukankan      html  css  js  c++  java
  • python pip报错pip._ vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

    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


  • 相关阅读:
    SVN 使用教程
    MVC图片上传压缩
    MVC 上传下载压缩
    C# WinForm生成二维码,一维码,条形码 操作
    C#MVC生成二维码
    ajax post方式提交到.net core api
    .net core多文件上传 日志记录
    C# .net Core 文件上传
    C#.netmvc单文件上传 ajax上传文件
    详细的sql语句
  • 原文地址:https://www.cnblogs.com/cheng10/p/11344883.html
Copyright © 2011-2022 走看看