Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use pip package Management tool in python

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you how to use the pip package management tool in python, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Hello, readers. Today we learn python's pip package management tool and record the learning process. Welcome to share with us.

The pip tool is a command executed in a command. Here I create a new python file py3_pip.py to write usage and comments to the file, not as python code:

# pip is a Python package management tool that provides # find, download, install, and uninstall functions for Python packages. # Python 2.7.9 + or Python 3.4 + comes with pip tools. # pip official website: https://pypi.org/project/pip/# can pass pip-- version to test whether it is installed # if not installed You can visit the pip official website installation # execute pip in cmd-- version:C:\ Users\ Administrator > pip-- version# to view the version information of pip pip 10.0.1 from c:\ users\ administrator\ appdata\ local\ programs\ python\ python37\ lib\ site-packages\ pip (python 3.7) # use pip help to view pip's use help C:\ Users\ Administrator > pip helpUsage: pip [options] Commands: install Install packages.# installation package uninstall Uninstall packages. # Uninstall package freeze Output installed packages in requirements format.# export package information in the specified format list List installed packages.# View the installed package search Search PyPI for packages.# search package help Show help for commands.General Options:-h -- help Show help. V,-- version Show version and exit. -Q,-- quiet Give less output. Option.# next let's search the time zone package pytz#pip search pytzC:\ Users\ Administrator > pip search pytzpytz (2019.1)-World timezone definition...# start installation pytz#pip install pytzC:\ Users\ Administrator > pip install pytz.Installing collected packages: pytzSuccessfully installed pytz-2019.1 # after the installation is complete, you can import the package into the python code and use # eg:import pytz# to view the installed Package # pip listC:\ Users\ Administrator > pip listPackage Version--pytz 2019.1pywin32 224requests 2.20.0Scrapy 1.6.0. # Uninstall the installation package pytz#pip uninstall pytzC:\ Users\ Administrator > pip uninstall pytz. Successfully uninstalled pytz-2019.1 # use pip list-o to view the version comparison of the installation package C:\ Users\ Administrator > pip list-oPackage Version Latest Type--beautifulsoup4 4.6.3 4.7.1 wheelpip 10.0.1 19.1.1 wheelrequests 2 .20.0 2.22.0 wheelsetuptools 39.0.1 41.0.1 wheel.# here we upgrade setuptools to version 41.0.1 # use pip install-U setuptoolsC:\ Users\ Administrator > pip install-U setuptools Successfully uninstalled setuptools-39.0.1Successfully installed setuptools-41.0.1# use pip freeze to enter the format information we need for the installed package C:\ Users\ Administrator > pip freezeAutomat==0.7.0beautifulsoup4==4. 6.3bs4==0.0.1.# writes the information to a text file to C:\ Users\ Administrator > pip freeze > pkginfo.txt# install C:\ Users\ Administrator > pip install-r pkginfo.txt# using pip list-- outdated to see which packages are not the latest version C:\ Users\ Administrator > pip list-- outdatedbeautifulsoup4 4.6.3 4.7.1 wheelcertifi 2018.10.15 2019.3.9 Wheel.# the following command is used in linux as a command to update all local packages to the latest version # pip freez-local | grep-v'^\-e' | cut-d =-f 1 | xargs-N1 pip install-U the above is how to use the pip package management tool in python Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report