• PIP安装模块下载慢或者无法下载


    pip下载不动,模块安装失败

    由于pip默认的下载源在国外,下载的人也多,难免有时会抽风,下载慢还能熬一熬,有时候就直接安装失败了。

    安装gevent模块的的时候,进度条慢悠悠的到达100%,以为马上就成功了,结果又卡住了。python今天给我好好的上了一课,电脑就是工程师吃饭的家伙,这装不上怎么能行呢?看来是时候捣鼓一下我的电脑了。

    其实卡住的原因很简单,本身网速慢,然后它不止一个gevent模块,还会有什么哥哥姐姐的关联模块。我真是吐血,那得下载到明年了。

    解决方案如下:

    通过添加配置文件永久更换pip安装源至国内镜像

    清华: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/

    1、在C:Users24030下新建一个pip文件夹

    2、在pip文件夹里面创建如下pip.ini文件,用于保存pip安装源地址

    [global]
    index-url = https://pypi.tuna.tsinghua.edu.cn/simple
    

     

    3、文件保存好后,再来到cmd,输入pip install xxx的时候,你就会发现,无论安装什么模块,都是秒下载。

    然后是导入gevent模块报错的解决方案

    只需要执行一下下面这段代码就可以了

    pip3 install -U --force-reinstall --no-binary :all: gevent
    

    附上参数说明

    -U, --upgrade
    Upgrade all specified packages to the newest available version. The handling of dependencies depends on the upgrade-strategy used.
    --force-reinstall
    Reinstall all packages even if they are already up-to-date.
    --no-binary <format_control>
    Do not use binary packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either :all: to disable all binary packages, :none: to empty the set, or one or more package names with commas between them. Note that some packages are tricky to compile and may fail to install when this option is used on them.

    这条命令的大概意思就是使用非二进制的包重新安装gevent以及它的依赖。

    总之在执行这个命令之后就完美的解决问题了。

    它的哥哥姐姐也太多了吧,气死我了!

  • 相关阅读:
    网络问题排查
    SpringBoot 自定义注解清除缓存
    MYSQL外键的使用以及优缺点
    Java List
    黑客帝国代码雨
    前端接收字节数据流,显示图片
    何为熔断降级
    spring的线程
    window.open 与 iframe
    js 全部替换
  • 原文地址:https://www.cnblogs.com/tu240302975/p/12304718.html
Copyright © 2020-2023  润新知