修改pip源加速pip安裝

2021-07-16 03:36:22 字數 552 閱讀 7688

國內很多提供pip倉庫的映象,可以通過指定訪問國內的源加速安裝。

1.安裝時手動指定

pip install ansible -i  --trusted-host mirrors.aliyun.com

2.寫入配置檔案,每次自動使用指定源安裝

cd

mkdir .pip

cd .pip

touch pip.conf

cat > pip.conf << eof

[global]

trusted-host=mirrors.aliyun.com

index-url=/

eof

國內可以穩定使用的映象有豆瓣的,阿里雲的,還有一些大學提供的映象。

阿里雲的映象上面不止有pip的源,還有epel和其他一些映象資源,比較方便。

修改PIP源為國內PIP源方式

在出現找不到安裝包的版本,例如安裝jieba 0.39的時候報錯 could not find a version that satisfies the requirement jieba 0.39 from versions no matching distribution found for j...

pip修改映象源

找到python安裝目錄下的 lib site packages pip models index.py檔案,將pypi的值改為你所需要的源即可,例如改為豆瓣的源。找不到 就直接搜尋 注 必須用https pypi index pypi index linux 修改pip映象源的方法 在當前使用者的...

PIP修改映象源

pip install i pandas pip freeze requirements.txt pip install i r requirements.txt python m pip install i upgrade pip 這樣就會從清華這邊的映象去安裝pandas庫。修改 pip pip...