一拳亿、在線pip安裝模塊
在使用pip安裝模塊時(shí)會因?yàn)榫W(wǎng)絡(luò)問題超時(shí)安裝失敗,現(xiàn)推薦阿里云和華清源來安裝相應(yīng)模塊辰狡。
1.寫入hosts (hosts地址: C:\Windows\Systen32\drivers\etc)
183.2.199.239 mirrors.aliyun.com
101.6.8.193 pypi.tuna.tsinghua.edu.cn
2.安裝方式二選一
pip install 包 -i https://pypi.tuna.tsinghua.edu.cn/simple/ #清華源
pip install 包 -i https://mirrors.aliyun.com/pypi/simple/ #阿里源
二、離線安裝模塊
在工作中有時(shí)需要再內(nèi)網(wǎng)安裝相應(yīng)模塊驹溃,但內(nèi)網(wǎng)中卻沒有網(wǎng)就需要打包模塊來離線安裝了
1.查詢安裝模塊
pip3 freeze >requirements.txt
2.導(dǎo)出安裝包
pip download -d DIR -r LIST
其中,DIR為離線庫導(dǎo)出路徑延曙,LIST為離線庫列表路徑,即requirements.txt 所在的路徑
3.離線庫快速安裝
pip install --no-index --find-links=DIR -r PATH
其中DIR為離線庫文件夾路徑豌鹤,PATH為離線庫列表文件路徑
三、pycharm快捷鍵
win
mac