SoFunction
Updated on 2024-11-10

How to install pip, a common download and install tool under Python.

1、pip download and install
1.1 pip download

# wget "/packages/source/p/pip/pip-1.5.#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate

# wget "/packages/source/p/pip/pip-1.5.#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate

1.2 pip installation

# tar -xzvf pip-1.5.
# cd pip-1.5.4
# python  install

# tar -xzvf pip-1.5.
# cd pip-1.5.4
# python  install

2. pip use in detail
2.1 pip installer

# pip install SomePackage
 [...]
 Successfully installed SomePackage

# pip install SomePackage
 [...]
 Successfully installed SomePackage

2.2 pip to view installed packages

# pip show --files SomePackage
 Name: SomePackage
 Version: 1.0
 Location: /my/env/lib//site-packages
 Files:
 ../somepackage/__init__.py
 [...]

# pip show --files SomePackage
 Name: SomePackage
 Version: 1.0
 Location: /my/env/lib//site-packages
 Files:
 ../somepackage/__init__.py
 [...]

2.3 pip checks which packages need to be updated

# pip list --outdated
 SomePackage (Current: 1.0 Latest: 2.0)

# pip list --outdated
 SomePackage (Current: 1.0 Latest: 2.0)

2.4 pip upgrade package

# pip install --upgrade SomePackage
 [...]
 Found existing installation: SomePackage 1.0
 Uninstalling SomePackage:
 Successfully uninstalled SomePackage
 Running  install for SomePackage
 Successfully installed SomePackage

# pip install --upgrade SomePackage
 [...]
 Found existing installation: SomePackage 1.0
 Uninstalling SomePackage:
 Successfully uninstalled SomePackage
 Running  install for SomePackage
 Successfully installed SomePackage

2.5 pip uninstall package

$ pip uninstall SomePackage
 Uninstalling SomePackage:
 /my/env/lib//site-packages/somepackage
 Proceed (y/n)? y
 Successfully uninstalled SomePackage

$ pip uninstall SomePackage

 

Uninstalling SomePackage:
 /my/env/lib//site-packages/somepackage
 Proceed (y/n)? y
 Successfully uninstalled SomePackage

3. Use pip domestic source
python using pip to install modules is very convenient, but the official source in the country will always be intermittent connection is not, in fact, python in the country is also a source of installation, such as Douban, the following is the use of methods.
file path

linux

~/.pip/

Contents of the document

[global] 

index-url = /simple 
trusted-host =  

Alternatively, use the -i command.

easy_install -i /simple/ saltTesting 
pip install -i /simple/ saltTesting 

pip installation:

1. Download and run

/

Switch to the directory: python

2. Add the environment variable: C:\Python27\Scripts.

C:\Users\Administrator>python --version

Python 2.7.8

C:\Users\Administrator>pip --version
pip 1.5.6 from C:\Python27\lib\site-packages (python 2.7)

C:\Users\Administrator> add environment variable C:\Python27;C:\Python27\Scripts;
'Add environment variable' is not an internal or external command, nor is it a runnable program
or batch file.

C:\Users\Administrator>pip install selenium
Requirement already satisfied (use --upgrade to upgrade): selenium in c:\python2
7\lib\site-packages
Cleaning up...

C:\Users\Administrator>python
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import selenium
>>>