python的pip配置的國(guó)內(nèi)鏡像的實(shí)現(xiàn)
常用國(guó)內(nèi)鏡像源列表
- 清華大學(xué):https://pypi.tuna.tsinghua.edu.cn/simple
- 阿里云:https://mirrors.aliyun.com/pypi/simple
- 中科大:https://pypi.mirrors.ustc.edu.cn/simple
- 華為云:https://repo.huaweicloud.com/repository/pypi/simple
- 豆瓣:https://pypi.doubanio.com/simple
Windows系統(tǒng)配置方法(PowerShell)
1. 臨時(shí)使用鏡像源 :
pip install package_name -i https://pypi.tuna.tsinghua.edu.cn/simple
2. 永久配置鏡像源 :
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
執(zhí)行示例:
C:\Users\admin>pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple Writing to C:\Users\admin\AppData\Roaming\pip\pip.ini
Writing to ...
表示 pip 已經(jīng)將新的配置寫(xiě)入到指定的配置文件中。在 Windows 系統(tǒng)中,用戶(hù)級(jí)別的 pip 配置文件路徑通常是:
C:\Users\你的用戶(hù)名\AppData\Roaming\pip\pip.ini
你看到的路徑完全正確,說(shuō)明配置成功生效。
3. 驗(yàn)證配置是否生效 :
pip config list
執(zhí)行示例:
C:\Users\admin>pip config list global.index-url='https://pypi.tuna.tsinghua.edu.cn/simple'
解決SSL驗(yàn)證問(wèn)題(需要時(shí))
pip install package_name --trusted-host pypi.tuna.tsinghua.edu.cn
執(zhí)行示例:
C:\Users\admin>pip install package_name --trusted-host pypi.tuna.tsinghua.edu.cn Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting package_name Downloading https://pypi.tuna.tsinghua.edu.cn/packages/61/5f/6690d5f0bad41818063e3f436c101deff0f243adede1d23642deb607349d/package_name-0.1.tar.gz (782 bytes) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: package_name Building wheel for package_name (pyproject.toml) ... done Created wheel for package_name: filename=package_name-0.1-py3-none-any.whl size=1249 sha256=42d4d6c6fdbbb196c2a799d4ad10002437e5ebf1f518623cb353a5af2f09def1 Stored in directory: c:\users\admin\appdata\local\pip\cache\wheels\82\c3\1b\f14c30dafba2a2afde388a04dac07caef2d1b03e22356314a3 Successfully built package_name Installing collected packages: package_name Successfully installed package_name-0.1
常用組合命令示例
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
requirements.txt文件內(nèi)容
這里面放著項(xiàng)目需要安裝的所有的依賴(lài)包;
torch<=2.3.0 torchaudio modelscope huggingface huggingface_hub funasr>=1.1.3 numpy<=1.26.4 gradio fastapi>=0.111.1
到此這篇關(guān)于python的pip配置的國(guó)內(nèi)鏡像的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)python pip配置國(guó)內(nèi)鏡像內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
python獲取當(dāng)前用戶(hù)的主目錄路徑方法(推薦)
下面小編就為大家?guī)?lái)一篇python獲取當(dāng)前用戶(hù)的主目錄路徑方法(推薦)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-01-01python正則表達(dá)式常見(jiàn)的知識(shí)點(diǎn)匯總
正則表達(dá)式提供了一些可用的匹配模式,比如忽略大小寫(xiě)、多行匹配等,下面這篇文章主要給大家介紹了關(guān)于python正則表達(dá)式常見(jiàn)的知識(shí)點(diǎn),文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2022-05-05python數(shù)據(jù)可視化Seaborn畫(huà)熱力圖
這篇文章主要介紹了數(shù)據(jù)可視化Seaborn畫(huà)熱力圖,熱力圖的想法其實(shí)很簡(jiǎn)單,用顏色替換數(shù)字,下面我們來(lái)看看文章對(duì)操作過(guò)程的具體介紹吧,需要的小伙伴可以參考一下具體內(nèi)容,希望對(duì)你有所幫助2022-01-01詳解Django中 render() 函數(shù)的使用方法
這篇文章主要介紹了Django中 render() 函數(shù)的使用方法,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-04-04python中子類(lèi)繼承父類(lèi)的__init__方法實(shí)例
這篇文章主要給大家詳細(xì)介紹了python中子類(lèi)如何繼承父類(lèi)的__init__方法,文中給出了詳細(xì)的示例代碼,相信對(duì)大家的理解和學(xué)習(xí)具有一定參考價(jià)值,有需要的朋友們下面來(lái)跟著小編一起學(xué)習(xí)學(xué)習(xí)吧。2016-12-12Python+wxPython構(gòu)建中文OCR截圖工具
隨著數(shù)字化時(shí)代的到來(lái),我們經(jīng)常需要從圖像中提取文本信息,本文將介紹如何使用Python編程語(yǔ)言和wxPython圖形用戶(hù)界面庫(kù)構(gòu)建一個(gè)簡(jiǎn)單的中文OCR截圖工具,需要的可以參考下2023-08-08python深度學(xué)習(xí)tensorflow1.0參數(shù)初始化initializer
這篇文章主要為大家介紹了python深度學(xué)習(xí)tensorflow1.0參數(shù)初始化initializer示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-06-06解決plt.savefig()和plt.show()方法得到的圖片不一樣問(wèn)題
這篇文章主要介紹了解決plt.savefig()和plt.show()方法得到的圖片不一樣問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-08-08詳解python os.path.exists判斷文件或文件夾是否存在
這篇文章主要介紹了詳解python os.path.exists判斷文件或文件夾是否存在,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-11-11