Python pip install如何修改默認下載路徑
pip動不動就下載數百M的文件。這些文件默認在C:盤,那么為了節省空間需要修改這些路徑:
打開cmd命令窗口。輸入:
python -m site
C:Usershewei>python -m sitesys.path = [ ’C:Usersxxx’, ’D:Program FilesPython37python37.zip’, ’D:Program FilesPython37DLLs’, ’D:Program FilesPython37lib’, ’D:Program FilesPython37’, ’D:Program FilesPython37libsite-packages’,]USER_BASE: ’C:UsersxxxAppDataRoamingPython’ (doesn’t exist)USER_SITE: ’C:UsersxxxAppDataRoamingPythonPython37site-packages’ (doesn’t exist)ENABLE_USER_SITE: True
可以看到你的python安裝目錄,和
USER_SITE:自定義Python依賴安裝包的基礎路徑。
USER_BASE:自定義Python腳本
python -m site -help
查看site.py的路徑
C:Usershewei>python -m site -helpD:Program FilesPython37libsite.py [--user-base] [--user-site]
打開site.py 修改:
修改為自己路徑。這里要注意盡量寫到python目錄下
在利用pip誰便安裝一個包。去USER_SITE目錄下發現包在這里已經成功了
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。
相關文章: