Fundamentals of python (20): complete collection of PIP commands

Time:2022-1-6

preface

Xiao Yuan began to updatePython series of teaching articles, from zero to get you started, looking forward to your attention, the foundation is not strong, the earth is shaking, so don't review it soon❤️❤️
Fundamentals of python (I): Python and vscode environment installation
Fundamentals of python (II): necessary for getting started
Fundamentals of python (3): operators
Fundamentals of python (4): data types
Python Basics (V): basic statements
Fundamentals of python (6): Functions
Fundamentals of python (VII): review of advanced variable types
Python Foundation (8): business card management system
Fundamentals of python (IX): Advanced variables
Fundamentals of python (10): advanced functions
Fundamentals of python (11): basic concepts of object orientation
Fundamentals of python (XII): classes and objects
Fundamentals of python (13): object oriented basic syntax
Fundamentals of python (XIV): private properties and private methods
Fundamentals of python (XV): Inheritance
Fundamentals of python (XVI): polymorphism
Fundamentals of python (17): class properties and class methods
Fundamentals of python (18): single example
Python Basics (19): exceptions
Fundamentals of python (20): complete collection of PIP commands
Fundamentals of python (21): modules and packages
Fundamentals of python (22): Eval function
Python foundation conclusion (23): files

PIP common commands

View the path of Pip

where pip

View PIP version

pip -V
pip --version

PIP upgrade command

python -m pip install --upgrade pip

If the network connection of the default source of PIP is poor, temporarily use this mirror station to upgrade:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U

Installation package

First kind

pip install package_ Name # here is the package_ Name is the name of the third-party library to install

SecondRecommended for faster download): use domestic image source

pip install package_name -i http://mirrors.aliyun.com/pypi/simple/ 

Domestic image source

  • Alibaba cloud: http://mirrors.aliyun.com/pypi/simple/ (recommended)
  • Tsinghua University: https://pypi.tuna.tsinghua.edu.cn/simple
  • Watercress: http://pypi.douban.com/simple/

Third(specify package version number):

pip install package_ Name = version number

Fourth(local file installation):

  • Download package:https://pypi.org/

  • Search package name
    Fundamentals of python (20): complete collection of PIP commands

  • Find the corresponding version
    Fundamentals of python (20): complete collection of PIP commands

  • Click download
    Fundamentals of python (20): complete collection of PIP commands

  • Download the corresponding WHL file (my Python version is 3.8, and my computer windows 64 bit)
    Fundamentals of python (20): complete collection of PIP commands

  • Execute installation command

    pip install C:\Users\Administrator\Downloads\pymssql-2.2.2-cp38-cp38-win_ amd64. WHL # is followed by the package path and package name
  • Installation succeeded:
    Fundamentals of python (20): complete collection of PIP commands

Global set mirror source address

It’s too troublesome to add a domestic image address for each installation. You can set a fixed configuration

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

Uninstall package

pip uninstall package_ Name # here is the package_ Name is the name of the third-party library to uninstall

Search package

pip search package_name

View all installed packages

pip list

View installation package details

pip show package_name

Update the specified package

pip install --upgrade package_name

View packages that need to be updated

pip list --outdated

view help

pip -h
pip --help

Usage:  
 pip<command>[options]
 
Commands:
 Install installation package
 Uninstall uninstall package
 Freeze outputs a list of installed packages in a certain format
 List lists installed packages
 Show displays package details
 Search Search package, similar to search.com in yum
 wheel                      Buildwheelsfromyourrequirements.
 Zip is not recommended Zipindividualpackages.
 Unzip is not recommended Unzipindividualpackages.
 Bundle is not recommended Createpybundles.
 Help current help
 
GeneralOptions:
 -h. -- help displays help
 -v. -- verbose more output, which can be used up to 3 times
 -5. -- version real version information and exit
 -q. -- quiet minimum output
 --Log file < Path > records verbose error logs by overwriting. The default file is: / root / pip/pip. log
 --Log < Path > does not overwrite the log recording verbose output
 --proxy<proxy>            Specifyaproxyintheform[user:[email protected]]proxy.server:port.
 --Timeout < sec > connection timeout (default: 15 seconds)
 --exists-action<action>   Defaultactionwhenapathalreadyexists:(s)witch,(i)gnore,(w)ipe,(b)ackup.
 --CERT < Path > certificate

Error reporting problem

Error reporting for permission problem

Fundamentals of python (20): complete collection of PIP commands
add--trusted-host mirrors.aliyun.comsuffix

pip install pymssql -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

Fundamentals of python (20): complete collection of PIP commands