解決PyCharm安裝包慢問題


問題描述:使用PyCharm中pip安裝包時特別慢。

解決方法:換成國內鏡像源

方案一:指定鏡像地址

pip 命令中添加 -i 參數指定鏡像地址,如:

pip install xxx -i https://pypi.tuna.tsinghua.edu.cn/simple

其他可用鏡像地址包括:

# 清華鏡像站
https://pypi.tuna.tsinghua.edu.cn/simple
# 中科大鏡像站
https://pypi.mirrors.ustc.edu.cn/simple
# 豆瓣鏡像站
http://pypi.douban.com/simple/

方案二:PyCharm中添加國內鏡像站

第一步,PyCharm——File——Settings——定位到工程“Project:xxxx”——Project Interpreter——點擊加號

第二步,點擊Manage Repositories

第三步,添加鏡像源

方案三:全局 pip 配置

Windows下:

# 新建文件並編輯 C:\Users\xxx\pip\pip.ini
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn

Linux/MacOS下:

# 新建文件並編輯 ~/.pip/pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn

參考:

[1] pip 使用國內鏡像源, RUNOOB.COM

[2] PyCharm解決安裝慢的問題 更換pip源為國內源, CSDN, 魏有心


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM