什么是Python中的Pip?
Pip is a command and tool used to manage Python libraries, modules, and packages. Python has a lot of packages because of its popularity and installation, updating and removing them can be done with the Pip package manager.
Pip是用于管理Python庫,模塊和包的命令和工具。 由于Python的普及和安裝,Python有很多軟件包,可以使用Pip軟件包管理器來更新和刪除它們。
Python包索引 (Python Package Index)
First, we have to learn about Python packages and repository. Python Package Index of PyPI is a repository that stores and serves Python packages. PyPI is created by the Python Software Foundation. Currently I provides 196,370 projects with 1,465,722 releases with 371,687 users.
首先,我們必須了解Python軟件包和存儲庫。 PyPI的Python軟件包索引是一個存儲和提供Python軟件包的存儲庫。 PyPI由Python軟件基金會創建。 目前,我為196,370個項目提供了1,465,722個版本,擁有371,687個用戶。
https://pypi.org
https://pypi.org
Python Package Index Python包索引From PyPI, we can search or browse projects and packages. For example, when we search for Django we will see the following results. We will click to the Django 2.2.5 which is the official Django project.
通過PyPI,我們可以搜索或瀏覽項目和程序包。 例如,當我們搜索Django時,將看到以下結果。 我們將單擊官方的Django項目Django 2.2.5 。
Python Package Index Search Python軟件包索引搜索We will be redirected to the following Django Pip Package page which provides information like installation, project description, release history, download files bug tracker, source code, funding, and documentation.
我們將被重定向到下面的Django Pip Package頁面,該頁面提供諸如安裝,項目描述,發行歷史,下載文件,錯誤跟蹤器,源代碼,資金和文檔之類的信息。
https://pypi.org/project/Django/
https://pypi.org/project/Django/
Python Package Index Package Details Python軟件包索引軟件包詳細信息安裝點(Installing Pip)
As Python is a cross-platform scripting/programming language also the package manager Pip is cross-platform too. We can install Pip for operating systems like Windows, Linux, Ubuntu, Fedora, Ubuntu, CentOS, Kali, Mint, MacOSX, RaspberryPi, etc where Python interpreter works. Below you can find how to install Pip for different operating systems and platforms.
由于Python是一種跨平臺的腳本/編程語言,因此程序包管理器Pip也是跨平臺的。 我們可以為Windows解釋器可在Windows,Linux,Ubuntu,Fedora,Ubuntu,CentOS,Kali,Mint,MacOSX,RaspberryPi等操作系統上安裝Pip。 您可以在下面找到如何為不同的操作系統和平臺安裝Pip。
How To Install Python Pip For Linux?
如何為Linux安裝Python Pip?
點用法和命令 (Pip Usage and Commands)
In this part, we will learn basic usage of Pip and its commands. Pip provides commands to search, install, update, list, etc. packages.
在這一部分中,我們將學習Pip及其命令的基本用法。 Pip提供了用于搜索,安裝,更新,列出等軟件包的命令。
點幫助和列表命令 (Pip Help and List Commands)
We can use the -h option in order to list simple help information about the pip command like below. Also, general options will be listed.
我們可以使用-h選項來列出有關pip命令的簡單幫助信息,如下所示。 另外,將列出常規選項。
$ pip -h Pip Help and List Commands 點幫助和列表命令For more detailed help man command can be used. This will list all available commands and options about the pip.
要獲得更詳細的幫助,可以使用man命令。 這將列出有關點的所有可用命令和選項。
$ man pip Pip Help and List Commands 點幫助和列表命令搜索Python包(Search Python Package)
We can use the search command and provide the term or package name we want to search. In this example, we will search the package named django.
我們可以使用search命令并提供我們要搜索的術語或軟件包名稱。 在此示例中,我們將搜索名為django的軟件包。
$ pip3 search django Search Python Package 搜索Python包顯示Python軟件包信息(Show Python Package Information)
We can show the package information with the pip command by using showcommand and providing the package name we want to show information. In this example, we will show information about the Django package.
我們可以使用show命令并通過pip命令顯示軟件包信息,并提供要顯示信息的軟件包名稱。 在此示例中,我們將顯示有關Django軟件包的信息。
$ pip3 show django Show Python Package Information 顯示Python軟件包信息安裝Python包(Install Python Package)
We can install a package by using the install pip command. We will also provide the package complete name. In this example, we will install the package named Django. During the installation, the main package and its dependencies will be downloaded and extracted required fields.
我們可以使用install pip命令安裝軟件包。 我們還將提供包裹的全名。 在此示例中,我們將安裝名為Django的軟件包。 在安裝過程中,將下載主軟件包及其依賴項并提取必填字段。
$ pip3 install django Install Python Package 安裝Python包更新Python包(Update Python Package)
Popular python packages are updated regularly.? We can update the already installed package with the install --upgrade command of the pip. We will also provide the package named django in this example.
流行的python軟件包會定期更新。 我們可以使用pip的install --upgrade命令更新已經安裝的軟件包。 在此示例中,我們還將提供名為django的軟件包。
$ pip3 install --upgrade django Update Python Package 更新Python包列出已安裝的Python軟件包(List Installed Python Packages)
We can also list already installed packages. We will use list pip command like below.
我們還可以列出已經安裝的軟件包。 我們將使用list pip命令,如下所示。
$ pip3 list List Installed Python Packages 列出已安裝的Python軟件包 .u620c94c9f2a0865619e742a7e3b7b6a2 , .u620c94c9f2a0865619e742a7e3b7b6a2 .postImageUrl , .u620c94c9f2a0865619e742a7e3b7b6a2 .centered-text-area { min-height: 80px; position: relative; } .u620c94c9f2a0865619e742a7e3b7b6a2 , .u620c94c9f2a0865619e742a7e3b7b6a2:hover , .u620c94c9f2a0865619e742a7e3b7b6a2:visited , .u620c94c9f2a0865619e742a7e3b7b6a2:active { border:0!important; } .u620c94c9f2a0865619e742a7e3b7b6a2 .clearfix:after { content: ""; display: table; clear: both; } .u620c94c9f2a0865619e742a7e3b7b6a2 { 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); } .u620c94c9f2a0865619e742a7e3b7b6a2:active , .u620c94c9f2a0865619e742a7e3b7b6a2:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u620c94c9f2a0865619e742a7e3b7b6a2 .centered-text-area { width: 100%; position: relative; } .u620c94c9f2a0865619e742a7e3b7b6a2 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u620c94c9f2a0865619e742a7e3b7b6a2 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u620c94c9f2a0865619e742a7e3b7b6a2 .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; } .u620c94c9f2a0865619e742a7e3b7b6a2:hover .ctaButton { background-color: #E67E22!important; } .u620c94c9f2a0865619e742a7e3b7b6a2 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u620c94c9f2a0865619e742a7e3b7b6a2 .u620c94c9f2a0865619e742a7e3b7b6a2-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u620c94c9f2a0865619e742a7e3b7b6a2:after { content: ""; display: block; clear: both; } LEARN MORE? How To Uninstall A Package with Pip? .u620c94c9f2a0865619e742a7e3b7b6a2 , .u620c94c9f2a0865619e742a7e3b7b6a2 .postImageUrl , .u620c94c9f2a0865619e742a7e3b7b6a2 .centered-text-area { min-height: 80px; position: relative; } .u620c94c9f2a0865619e742a7e3b7b6a2 , .u620c94c9f2a0865619e742a7e3b7b6a2:hover , .u620c94c9f2a0865619e742a7e3b7b6a2:visited , .u620c94c9f2a0865619e742a7e3b7b6a2:active { border:0!important; } .u620c94c9f2a0865619e742a7e3b7b6a2 .clearfix:after { content: ""; display: table; clear: both; } .u620c94c9f2a0865619e742a7e3b7b6a2 { 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); } .u620c94c9f2a0865619e742a7e3b7b6a2:active , .u620c94c9f2a0865619e742a7e3b7b6a2:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u620c94c9f2a0865619e742a7e3b7b6a2 .centered-text-area { width: 100%; position: relative; } .u620c94c9f2a0865619e742a7e3b7b6a2 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u620c94c9f2a0865619e742a7e3b7b6a2 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u620c94c9f2a0865619e742a7e3b7b6a2 .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; } .u620c94c9f2a0865619e742a7e3b7b6a2:hover .ctaButton { background-color: #E67E22!important; } .u620c94c9f2a0865619e742a7e3b7b6a2 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u620c94c9f2a0865619e742a7e3b7b6a2 .u620c94c9f2a0865619e742a7e3b7b6a2-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u620c94c9f2a0865619e742a7e3b7b6a2:after { content: ""; display: block; clear: both; } 了解更多如何使用Pip卸載軟件包?翻譯自: https://www.poftut.com/what-is-pip-in-python/
總結
以上是生活随笔為你收集整理的什么是Python中的Pip?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 用Redis轻松实现秒杀系统
- 下一篇: websocket python爬虫_p