pip怎么卸载安装包_pip怎么卸载
Python Pip command provides search, install, update, uninstall packages. We can use pip command to uninstall packages easily even there are some alternatives like easy_install.
Python Pip命令提供搜索,安裝,更新,卸載軟件包。 即使有easy_install之類的替代方法,我們也可以使用pip命令輕松卸載軟件包。
用Pip列出已經安裝的Python軟件包 (List Already Installed Python Packages with Pip)
Before uninstalling or removing Python packages with pip we will list already installed Python packages. We will use list command for pip like below.
在通過pip卸載或刪除Python軟件包之前,我們將列出已安裝的Python軟件包。 我們將如下所示對pip使用list命令。 
$ pip list
We can see that the following information is provided by listing installed packages.
通過列出已安裝的軟件包,我們可以看到以下信息。
- `Package` column shows the package complete name
“包裹”列顯示包裹的完整名稱 
- `Version` column shows the most recent version of the given package
“版本”列顯示了給定軟件包的最新版本 
列出/顯示Python軟件包信息,版本(List/Display Python Packages Information, Version)
We can also show a given package complete information with the show command which can be useful before uninstalling it. In this example, we will show information about the Python package named Django.
我們還可以使用show命令顯示給定的軟件包完整信息,這在卸載之前可能很有用。 在此示例中,我們將顯示有關名為Django的Python軟件包的信息。 
$ pip show django
使用Pip,Pip2,Pip3卸載/刪除Python軟件包(Uninstall/Remove Python Package with Pip, Pip2, Pip3)
We can uninstall the package with the uninstall pip command. We will also provide the package name. In this example, we will uninstall the package named django.
我們可以使用uninstall pip命令來卸載軟件包。 我們還將提供包裹名稱。 在此示例中,我們將卸載名為django的軟件包。 
$ pip uninstall django
We can see that the directories and files removed are listed and a confirmation is shown where we will input y in order to accept the removal. After the remove/uninstall completed we will be shown Successfully uninstalled Django-2.2.5
我們可以看到列出了刪除的目錄和文件,并顯示了一個確認,我們將在其中輸入y以接受刪除。 刪除/卸載完成后,我們將顯示Successfully uninstalled Django-2.2.5
If we want to remove packages related to the Python2 we can use the same command for the pip2command like below.
 如果我們想刪除與Python2相關的軟件包,我們可以對pip2命令使用相同的命令,如下所示。 
$ pip2 uninstall django
If we want to remove packages related to the Python3 we can use the same command for the pip3command like below.
 如果我們想刪除與Python3相關的軟件包,我們可以對pip3命令使用相同的命令,如下所示。 
$ pip3 uninstall django
使用Pip卸載/刪除具有要求的Python軟件包 (Uninstall/Remove Python Package with Requirements with Pip)
Modern Python applications and projects provide the required files in order to list the package list which should be installed. We can use this requirement file in order to specify the packages we have to remove the requirement file. In this example, the requirement file contains the following content with the name of requirements.txt.
現代Python應用程序和項目提供了必需的文件,以便列出應安裝的軟件包列表。 我們可以使用此需求文件來指定必須刪除需求文件的軟件包。 在此示例中,需求文件包含以下內容,其名稱為requirements.txt 。 
django
pycups
PyGObject
PyJWT
pymacaroons
PyNaCl
pyRFC3339
AND we will remove this requirements.txt file content like below.
并且我們將刪除此requirements.txt文件內容,如下所示。
$ pip uninstall requirements.txt
無需詢問Pip即可卸載/刪除Python軟件包 (Uninstall/Remove Python Package Without Asking Confirmation with Pip)
By default the package uninstallation or removal requires a confirmation from the user. This is generally providing the y which is a short form of Yes to accept package uninstall. We can automatically accept the confirmation and skip it with the -y or --yes option like below.
默認情況下,軟件包的卸載或刪除需要用戶的確認。 通常,這是提供y形式, Yes接受軟件包卸載的縮寫。 我們可以自動接受確認,并使用-y或--yes選項跳過它,如下所示。 
$ pip uninstall -y django
$ pip2 uninstall -y django
$ pip3 uninstall -y django
使用Pip卸載/刪除特定用戶的Python軟件包 (Uninstall/Remove Python Package For Specific User with Pip)
pip Python packages may be installed for a specific user into the users home directory. So we can uninstall given python package for a specific user with the --user option by providing the user name. In this example, we will remove packages for the current user.
pip Python軟件包可以為特定用戶安裝到用戶的主目錄中。 因此,我們可以使用--user選項通過提供用戶名來卸載特定用戶的給定python軟件包。 在此示例中,我們將刪除當前用戶的軟件包。 
$ pip uninstall --user django
$ pip2 uninstall --user django
$ pip3 uninstall --user django
使用easy_install卸載/刪除Python軟件包 (Uninstall/Remove Python Package with easy_install)
We can also use the easy_install command in order to remove installed python packages. We will use -m option and provide the package name. In this example, we will remove the package named django with the easy_install command.
我們還可以使用easy_install命令來刪除已安裝的python軟件包。 我們將使用-m選項并提供軟件包名稱。 在此示例中,我們將使用easy_install命令刪除名為django的軟件包。 
$ easy_install -m django
.ue6353ce88552e6dbc1e8148a68b93656 , .ue6353ce88552e6dbc1e8148a68b93656 .postImageUrl , .ue6353ce88552e6dbc1e8148a68b93656 .centered-text-area{min-height:80px;position:relative;}
.ue6353ce88552e6dbc1e8148a68b93656 , .ue6353ce88552e6dbc1e8148a68b93656:hover , .ue6353ce88552e6dbc1e8148a68b93656:visited , .ue6353ce88552e6dbc1e8148a68b93656:active{border:0!important;}
.ue6353ce88552e6dbc1e8148a68b93656 .clearfix:after{content:"";display:table;clear:both;}
.ue6353ce88552e6dbc1e8148a68b93656{display:block;transition:background-color 250ms;webkit-transition:background-color 250ms;width:100%;opacity:1;transition:opacity 250ms;webkit-transition:opacity 250ms;background-color:#ECF0F1;box-shadow:0 1px 2px rgba(0, 0, 0, 0.17);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.17);-o-box-shadow:0 1px 2px rgba(0, 0, 0, 0.17);-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.17);}
.ue6353ce88552e6dbc1e8148a68b93656:active , .ue6353ce88552e6dbc1e8148a68b93656:hover{opacity:1;transition:opacity 250ms;webkit-transition:opacity 250ms;background-color:#D35400;}
.ue6353ce88552e6dbc1e8148a68b93656 .centered-text-area{width:100%;position:relative;}
.ue6353ce88552e6dbc1e8148a68b93656 .ctaText{border-bottom:0 solid #fff;color:#3498DB;font-size:16px;font-weight:bold;margin:0;padding:0;text-decoration:underline;}
.ue6353ce88552e6dbc1e8148a68b93656 .postTitle{color:#27AE60;font-size:16px;font-weight:600;margin:0;padding:0;width:100%;}
.ue6353ce88552e6dbc1e8148a68b93656 .ctaButton{background-color:#e6e6e6!important;color:#3498DB;border:none;border-radius:3px;box-shadow:none;font-size:14px;font-weight:bold;line-height:26px;moz-border-radius:3px;text-align:center;text-decoration:none;text-shadow:none;width:80px;min-height:80px;background:url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat;position:absolute;right:0;top:0;}
.ue6353ce88552e6dbc1e8148a68b93656:hover .ctaButton{background-color:#E67E22!important;}
.ue6353ce88552e6dbc1e8148a68b93656 .centered-text{display:table;height:80px;padding-left:18px;top:0;}
.ue6353ce88552e6dbc1e8148a68b93656 .ue6353ce88552e6dbc1e8148a68b93656-content{display:table-cell;margin:0;padding:0;padding-right:108px;position:relative;vertical-align:middle;width:100%;}
.ue6353ce88552e6dbc1e8148a68b93656:after{content:"";display:block;clear:both;}
LEARN MORE How To Install Numpy For Linux?
.ue6353ce88552e6dbc1e8148a68b93656 , .ue6353ce88552e6dbc1e8148a68b93656 .postImageUrl , .ue6353ce88552e6dbc1e8148a68b93656 .centered-text-area{min-height:80px;position:relative;}
.ue6353ce88552e6dbc1e8148a68b93656 , .ue6353ce88552e6dbc1e8148a68b93656:hover , .ue6353ce88552e6dbc1e8148a68b93656:visited , .ue6353ce88552e6dbc1e8148a68b93656:active{border:0!important;}
.ue6353ce88552e6dbc1e8148a68b93656 .clearfix:after{content:"";display:table;clear:both;}
.ue6353ce88552e6dbc1e8148a68b93656{display:block;transition:background-color 250ms;webkit-transition:background-color 250ms;width:100%;opacity:1;transition:opacity 250ms;webkit-transition:opacity 250ms;background-color:#ECF0F1;box-shadow:0 1px 2px rgba(0, 0, 0, 0.17);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.17);-o-box-shadow:0 1px 2px rgba(0, 0, 0, 0.17);-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.17);}
.ue6353ce88552e6dbc1e8148a68b93656:active , .ue6353ce88552e6dbc1e8148a68b93656:hover{opacity:1;transition:opacity 250ms;webkit-transition:opacity 250ms;background-color:#D35400;}
.ue6353ce88552e6dbc1e8148a68b93656 .centered-text-area{width:100%;position:relative;}
.ue6353ce88552e6dbc1e8148a68b93656 .ctaText{border-bottom:0 solid #fff;color:#3498DB;font-size:16px;font-weight:bold;margin:0;padding:0;text-decoration:underline;}
.ue6353ce88552e6dbc1e8148a68b93656 .postTitle{color:#27AE60;font-size:16px;font-weight:600;margin:0;padding:0;width:100%;}
.ue6353ce88552e6dbc1e8148a68b93656 .ctaButton{background-color:#e6e6e6!important;color:#3498DB;border:none;border-radius:3px;box-shadow:none;font-size:14px;font-weight:bold;line-height:26px;moz-border-radius:3px;text-align:center;text-decoration:none;text-shadow:none;width:80px;min-height:80px;background:url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat;position:absolute;right:0;top:0;}
.ue6353ce88552e6dbc1e8148a68b93656:hover .ctaButton{background-color:#E67E22!important;}
.ue6353ce88552e6dbc1e8148a68b93656 .centered-text{display:table;height:80px;padding-left:18px;top:0;}
.ue6353ce88552e6dbc1e8148a68b93656 .ue6353ce88552e6dbc1e8148a68b93656-content{display:table-cell;margin:0;padding:0;padding-right:108px;position:relative;vertical-align:middle;width:100%;}
.ue6353ce88552e6dbc1e8148a68b93656:after{content:"";display:block;clear:both;} 了解更多如何為Linux安裝Numpy?
翻譯自: https://www.poftut.com/how-to-uninstall-a-package-with-pip/
總結
以上是生活随笔為你收集整理的pip怎么卸载安装包_pip怎么卸载的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 从CNNIC的“中国互联网报告”看到希望
- 下一篇: 部署Small Business Ser
