zoukankan      html  css  js  c++  java
  • Python3 解决windows里PIP下载安装速度慢

      直接保存为xxx.py运行即可

      自动在用户文件夹创建pip文件夹,并创建配置文件:pip.ini

      从此告别pip install XXXX 下载模块速度超级慢的问题!

      # -*- coding: utf-8 -*-

      """

      Python3 --> 解决PIP下载安装速度慢

      """

      import os

      PATH = f"C:{os.environ['HOMEPATH']}\pip"

      FILE = 'pip.ini'

      # 国内源:郑州妇科医院哪家好 http://www.kd0371.com/

      # 新版ubuntu要求使用https源,要注意。

      DICTURL = {

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

      }

      # pip.ini 配置文件内容

      INFO = f"""[global]

      index-url = {DICTURL['阿里云']}

      [install]

      trusted-host=mirrors.aliyun.com"""

      # 判断pip文件夹是否存在,存在跳过,不存在创建

      if not os.path.exists(PATH):

      os.mkdir(PATH)

      # 创建配置文件,写入内容

      with open(os.path.join(PATH, FILE), 'w', encoding='utf-8') as f:

      f.write(INFO)

      print(f'用户路径:{PATH} 配置文件:{FILE} ****创建成功!****')

  • 相关阅读:
    CF1066D Boxes Packing
    luogu P2508 [HAOI2008]圆上的整点
    luogu P2502 [HAOI2006]旅行
    luogu P2511 [HAOI2008]木棍分割
    luogu P4161 [SCOI2009]游戏
    luogu P4160 [SCOI2009]生日快乐
    windows2012系统IE浏览器无法打开加载flashplayer内容
    kvm虚拟机相关
    esxI开启虚拟化
    Termux 详细安装
  • 原文地址:https://www.cnblogs.com/djw12333/p/11982461.html
Copyright © 2011-2022 走看看