因為python默認使用的是國外鏡像,有時候下載非常慢,最快的辦法就是在下載命令中增加國內源:
pip install requests -i https://pypi.tuna.tsinghua.edu.cn/simple
常用的國內源如下:
清華大學 https://pypi.tuna.tsinghua.edu.cn/simple/
阿里雲 http://mirrors.aliyun.com/pypi/simple/
中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
中國科學技術大學 http://pypi.mirrors.ustc.edu.cn/simple/
但是每次都要輸入url特別不方便,其實我們可以全局修改pip的下載源,這樣以后都不需要寫國內源的路徑了。
Windows(示例win10)
創建一個文件pip.ini

文件內容
[global]index-url = https://pypi.tuna.tsinghua.edu.cn/simple
在用戶目錄下,新建一個pip文件夾

查看是否配置成功:
pip config list

看一下下載速度是不是變快了

如果嫌麻煩,可以直接執行如下python代碼,快速搞定配置。
import os ini = "[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple/\n" pippath=os.environ["USERPROFILE"]+"\\pip\\" exec("if not os.path.exists(pippath):\n\tos.mkdir(pippath)") open(pippath+"/pip.ini","w+").write(ini)
Linux or Mac
首先在用戶目錄下新建.pip文件夾
mkdir ~/.pip
在該目錄下新建配置文件pip.conf,輸入如下內容,保存:
[global]index-url = https://pypi.tuna.tsinghua.edu.cn/simple
Pycharm中修改庫下載源
在setting中按如下路徑打開包下載

點擊Manage Respositories

點擊+添加國內源路徑即可。

注意:如果你是打算找python高薪工作的話。我建議你多寫點真實的企業項目積累經驗。不然工作都找不到,當然很多人沒進過企業,怎么會存在項目經驗呢? 所以你得多找找企業項目實戰多練習下撒。如果你很懶不想找,也可以進我的Python交流圈:1156465813。群文件里面有我之前在做開發寫過的一些真實企業項目案例。你可以拿去學習,不懂都可以在裙里找我,有空會耐心給你解答下。
以下內容無用,為本篇博客被搜索引擎抓取使用
(* ̄︶ ̄)(* ̄︶ ̄)(* ̄︶ ̄)(* ̄︶ ̄)(* ̄︶ ̄)(* ̄︶ ̄)(* ̄︶ ̄)(* ̄︶ ̄)
python 是干什么的 零基礎學 python 要多久 python 為什么叫爬蟲
python 爬蟲菜鳥教程 python 爬蟲萬能代碼 python 爬蟲怎么掙錢
python 基礎教程 網絡爬蟲 python python 爬蟲經典例子
python 爬蟲
(* ̄︶ ̄)(* ̄︶ ̄)(* ̄︶ ̄)(* ̄︶ ̄)(* ̄︶ ̄)(* ̄︶ ̄)(* ̄︶ ̄)(* ̄︶ ̄)
以上內容無用,為本篇博客被搜索引擎抓取使用