1. 程式人生 > 實用技巧 >pip安裝源

pip安裝源

介紹

"""
1、採用國內源,加速下載模組的速度
2、常用pip源:
    -- 豆瓣:https://pypi.douban.com/simple
    -- 阿里:https://mirrors.aliyun.com/pypi/simple
3、加速安裝的命令:
    -- >: pip install -i https://pypi.douban.com/simple 模組名
"""

永久配置安裝源

Windows

"""
1、檔案管理器檔案路徑位址列敲:%APPDATA% 回車,快速進入 C:\Users\電腦使用者\AppData\Roaming 資料夾中
2、新建 pip 資料夾並在資料夾中新建 pip.ini 配置檔案
3、新增 pip.ini 配置檔案內容
"""

MacOS、Linux

"""
1、在使用者根目錄下 ~ 下建立 .pip 隱藏資料夾,如果已經有了可以跳過
    -- mkdir ~/.pip
2、進入 .pip 隱藏資料夾並建立 pip.conf 配置檔案
    -- cd ~/.pip && touch pip.conf
3、啟動 Finder(訪達) 按 cmd+shift+g 來的進入,輸入 ~/.pip 回車進入
4、新增 pip.conf 配置檔案內容
"""

配置檔案內容

"""
[global]
index-url = http://pypi.douban.com/simple
[install]
use-mirrors =true
mirrors =http://pypi.douban.com/simple/
trusted-host =pypi.douban.com
"""