This article brings you relevant knowledge about python, which mainly introduces issues related to the installation and use of pip, including upgrading pip, displaying installation package information, and viewing specified packages. Let’s take a look at the detailed information and so on. I hope it will be helpful to everyone.
Recommended learning: python video tutorial
pip is a Python package management tool. This tool provides the functions of searching, downloading, installing and uninstalling Python packages. All the packages you use now either come with them or are installed through pip. Python 2.7.9 or Python 3.4 or above comes with the pip tool.
You can use the command pip --version to determine whether it has been installed:
If you still If it is not installed, you can use the following two methods to install it:
1. Python comes with a ensurepip module, which can install pip in the Python environment. Enter the following command in cmd
py -m ensurepip --upgrade
2. You can also download a Python script and use the command line boot logic to install pip.
py get-pip.py
pip --version
pip --help
pip install -U pip
ps:升级需谨慎,经常看到pip提醒升级,然后输入命令回车,系统开始下载最新版安装包, 准备安装前卸载了旧版pip,然后新版又报错无法安装,只好又重装。
pip install SomePackage #The latest version
pip install SomePackage==1.0.4 #Specify the version
pip install 'SomePackage>=1.0.4' #The smallest version
For example, I want to install sklearn , enter pip install sklearn, the latest version of the package
pip install --upgrade SomePackage
升级指定的包,通过使用==, >=, , <h2>6. Uninstall package</h2><p><strong><span style="color:blue">pip uninstall SomePackage</span></strong></p><h2>7. Search package</h2><p><strong><span style="color:blue">pip search SomePackage</span></strong></p><h2>8. Display installation package information</h2><p><strong><span style="color:blue">pip show SomePackage</span></strong><br><img src="https://img.php.cn/upload/article/000/000/067/242888d8bfa43019edc970c8ab5edb0f-5.png" alt="One article to complete the installation and use of pip in Python"></p><h2>9. List installed packages</h2><p><strong><span style="max-width:90%">pip list</span></strong><br><img src="https://img.php.cn/upload/article/000/000/067/7361c4a9e66a41cb77df500fca51e01a-6.png" alt="One article to complete the installation and use of pip in Python"></p><h2>10. View detailed information of the specified package</h2><p><strong>##pip show -f SomePackage<span style="max-width:90%"></span></strong><br><img src="https://img.php.cn/upload/article/000/000/067/7361c4a9e66a41cb77df500fca51e01a-7.png" alt="One article to complete the installation and use of pip in Python"></p>Recommended learning:<p> python video tutorial<a href="https://www.php.cn/course/list/30.html" target="_blank"></a></p>
The above is the detailed content of One article to complete the installation and use of pip in Python. For more information, please follow other related articles on the PHP Chinese website!