Python PIP package manager

Creative Commons License Copyright: Attribution, allow others to create paper-based, and must distribute paper (based on the original license agreement with the same license Creative Commons )

Copyright, without permission, is prohibited reprint


chapter


What PIP that?

PIP is a Python package manager, like in Java Maven .

Note : If the Python version 3.4 or later, included by default PIP.

What is the package?

A package that contains all the files of a module.

Module is a library of Python code can be imported in the project, used.

Check whether the installation PIP

Command line, execute the following command:

Kevin@KEVIN-PC C:\Users\Kevin
> pip --version
pip 19.0.3 from d:\program files\python\lib\site-packages\pip (python 3.7)

Download a package

Download package is very simple.

Open a command-line tool, execute pip install 包名the command:

Examples

Download a Python package called "camelcase" of:

Kevin@KEVIN-PC C:\Users\Kevin
> pip install camelcase

Use a bag

Once the package is installed, it can be used.

The "camelcase" package into the project.

Examples

Import and use "camelcase":

import camelcase

c = camelcase.CamelCase()

txt = "long time no see"

print(c.hump(txt))

Find package

For more packages visit https://pypi.org/ .

Delete Package

You can use the uninstallcommand to delete a package:

Examples

Uninstall package called "camelcase" of:

Kevin@KEVIN-PC C:\Users\Kevin
> pip uninstall camelcase

Delete package procedure, will confirm whether you really want to delete:

Uninstalling camelcase-0.2:
  Would remove:
    d:\program files\python\lib\site-packages\camelcase-0.2-py3.7.egg-info
    d:\program files\python\lib\site-packages\camelcase\*
Proceed (y/n)? y
  Successfully uninstalled camelcase-0.2

Press the ybutton to confirm the deletion.

Package list

Use listcommand to list packages installed on the system:

Examples

Package installed on the system are listed:

Kevin@KEVIN-PC C:\Users\Kevin
> pip list

Output:

> pip list
Package    Version
---------- -------
pip        19.0.3
setuptools 40.8.0

Guess you like

Origin blog.csdn.net/weixin_43031412/article/details/94380399