Python Package Manager (pip):
pip is a package-management system written in Python used to install and manage software packages. It connects to an online repository of public packages, called the Python Package Index. ... Python 2.7. 9 and later (on the python2 series), and Python 3.4 and later include pip (pip3 for Python 3) by default.
Command-line interface
One major advantage of pip is the ease of its command-line interface, which makes installing Python software packages as easy as issuing a command:
Users can also easily remove the package:
Most importantly, pip has a feature to manage full lists of packages and corresponding version numbers, possible through a "requirements" file. This permits the efficient re-creation of an entire group of packages in a separate environment (e.g. another computer) or virtual environment. This can be achieved with a properly formatted file and the following command, where requirements.txt
is the name of the file:
To install some package for a specific python version, pip provides the following command, where ${version}
is replaced by 2, 3, 3.4, etc.:
Using setup.py
Pip provides a way to install user-defined projects locally with the use of setup.py file. This method requires the python project to have the following file structure:
Within this structure, user can add setup.py to the root of the project (i.e. example_project
for above structure) with the following content:
After this, pip can install this custom project by running the following command, from the project root directory:
No comments:
Post a Comment