常見用法
-
-
- pip解除安裝庫指令
- pip更新指令
- pip修改檔案預設安裝路徑
-
pip解除安裝庫指令
python unstall filename
pip更新指令
python -m pip install --upgrade pip
pip修改檔案預設安裝路徑
python -m site
首先,通過上面的指令我們會發現,pip預設安裝路徑是如下

但是因為個人并不喜歡在系統盤中有太多的檔案,是以想要修改預設下載下傳位置,是以,我在這又用了一條指令。
python -m site -help
在這裡我知道了,他的配置檔案是site.py,那我隻需要修改他的配置就可以了。
# Prefixes for site-packages; add additional prefixes like /usr/local here
PREFIXES = [sys.prefix, sys.exec_prefix]
# Enable per user site-packages directory
# set it to False to disable the feature or True to force the feature
ENABLE_USER_SITE = None
# for distutils.commands.install
# These values are initialized by the getuserbase() and getusersitepackages()
# functions, through the main() function when Python starts.
USER_SITE = None
USER_BASE = None
将我們需要的地方修改成
USER_SITE = "D:\python\Python37\Lib\site-packages"
USER_BASE = "D:\python"
儲存後我們再調用下上面的一個指令
python -m site
這時候我們就會發現預設的路徑已經修改了。
然後我在之後下載下傳庫的時候就用以下指令
python -m pip install -U flask --user
它會有個警告出來,但是可以忽略不計,檔案已經進入新的路徑并且下載下傳成功了!