Packages in Python
Overview of PIP Command
The pip command is a tool for installing and managing Python packages, such as those found in the Python Package Index. You can do the operations related to the pip from command prompt. To install any package through pip is very easy. Before installing any package pip should be installed. For the older version it should be installed manually but for the latest versions pip is inbuilt.
Go to the command prompt and practice these, for installing packages the Internet connection is required.
E:\Python35>pip download xlrd
Collecting xlrd
Downloading xlrd-1.1.0-py2.py3-none-any.whl (108kB) 100% |################################| 112kB 13kB/s Saved e:\python35\xlrd-1.1.0-py2.py3-none-any.whl Successfully downloaded xlrd |
E:\Python35>pip install xlrd
Requirement already satisfied: xlrd in e:\python35\lib\site-packages |
Freeze: To launch python from anywhere.
Verify a successful installation by opening a command prompt window and navigating to your Python installation’s script directory (default is C:\Python35\Scripts). Type pip freeze from this location to launch the Python interpreter. pip freeze displays the version number of all modules installed in your Python non-standard library; On a fresh install, pip freeze probably won’t have much info to show but we’re more interested in any errors that might pop up here than the actual content.
E:\Python35>c:
C:\>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32 Type “help”, “copyright”, “credits” or “license” for more information. >>> ^Z |
C:\>pip search xlrd
C:\>pip show xlrd
Name: xlrd
Version: 1.0.0 Summary: Library for developers to extract data from Microsoft Excel ™ spreadsheet files Home-page: http://www.python-excel.org/ Author: John Machin Author-email: sjmachin@lexicon.net License: BSD Location: e:\python35\lib\site-packages Requires: |
C:\>pip install coverage
Collecting coverage
Downloading coverage-4.5.1-cp35-cp35m-win_amd64.whl (181kB) 100% |################################| 184kB 62kB/s Installing collected packages: coverage Successfully installed coverage-4.5.1 |
C:\>pip show coverage
Name: coverage
Version: 4.5.1 Summary: Code coverage measurement for Python Home-page: https://bitbucket.org/ned/coveragepy Author: Ned Batchelder and 100 others Author-email: ned@nedbatchelder.com License: Apache 2.0 Location: e:\python35\lib\site-packages Requires: |
C:\>pip search coverage
odoo8-addon-runbot-coverage (8.0.1.0.0.99.dev2) – Collect coverage information during test_all
cobertura-aggregator (0.1) – Cobertura folder coverage aggregator |
C:\>pip uninstall coverage
…
Proceed (y/n)? y Successfully uninstalled coverage-4.5.1 |
E:\Python35>pip wheel xlrd
Collecting xlrd
File was already downloaded e:\python35\xlrd-1.1.0-py2.py3-none-any.whl |
Skipping xlrd, due to already being wheel.
Unofficial Windows Binaries for Python Extension Packages
We can get all the unofficial wheel files from the following link to install the packages.
Link for wheels: https://www.lfd.uci.edu/~gohlke/pythonlibs/
It is important to get the correct wheel file related to your python version. Search the “coverage” wheel and download the file related to your python version.
I have selected coverage‑4.5.1‑cp35‑cp35m‑win_amd64.whl file and downloaded in to the scripts folder in python.
To install this file go to the corresponding folder and then write the following command.
E:\Python35>cd scripts
E:\Python35\Scripts>pip install “coverage-4.5.1-cp35-cp35m-win_amd64.whl”
Processing e:\python35\scripts\coverage-4.5.1-cp35-cp35m-win_amd64.whl
Installing collected packages: coverage Successfully installed coverage-4.5.1 |
E:\Python35\Scripts>pip show coverage
Name: coverage
Version: 4.5.1 Summary: Code coverage measurement for Python Home-page: https://bitbucket.org/ned/coveragepy Author: Ned Batchelder and 100 others Author-email: ned@nedbatchelder.com License: Apache 2.0 Location: e:\python35\lib\site-packages Requires: |
In this way you can download the wheel files according to your requirements. The procedure is same for all the other wheels. If the version is not supported then it will not be installed and give an error.
Upgrading the pip:
To upgrade the version of pip you can use the following command at the command prompt.
python -m pip install -U pip
Pip list:
E:\Python35>pip list
attrs (17.4.0)
bleach (1.5.0) certifi (2017.11.5) chardet (3.0.4) …… |
E:\Python35>pip list –format columns