"pip" is a de facto standard package-management system used to install and manage software packages written in Python. Many packages can be found in the default source for packages and their dependencies — Python Package Index (PyPI). Most distributions of Python come with pip preinstalled. Python 2.7.9 and later (on the python2 series), and Python 3.4 and later include pip (pip3 for Python 3) by default. First introduced as pyinstall in 2008 by Ian Bicking (the creator of the virtualenv package) as an alternative to easy_install, pip was chosen as the new name from one of several suggestions that the creator received on his blog post. According to Bicking himself, the name is an acronym for "Pip Installs Packages". In 2011, the Python Packaging Authority (PyPA) was created to take over the maintenance of pip and virtualenv from Bicking, led by Carl Meyer, Brian Rosner, and Jannis Leidel. ~ ~ ~ "pip" INSTALLATION IN CASE IT IS NOT THERE. Installing with get-pip.py To install pip, securely 1 download get-pip.py by following this link: get-pip.py. Alternatively, use curl: bash $ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py Then run the following command in the folder where you have downloaded get-pip.py: bash $ python get-pip.py Ref: pip.pypa.io ~ ~ ~ FEW CHANGES IN THE ENVIRONMENT VARIABLES (OUR OS IS WINDOWS 10): 1: Add these to the 'PATH' variable: A: C:\Program Files (x86)\Python38 B: C:\Program Files (x86)\Python38\Scripts "Scripts" has files such as: easy_install.exe, easy_install-3.8.exe, pip.exe, pip3.8.exe, pip3.exe 2: Add a variable "PYTHONPATH" This is the location where Python packages will be installed. For us, it is: D:\Python_Repository\Python38 "Python38" has following contents: ~ ~ ~ Command-line interface 1: 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: pip install some-package-name 2: Users can also easily remove the package: pip uninstall some-package-name 3: 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: pip install -r requirements.txt 4: You can download a package and it's dependencies to the local disk instead of installing them. Using this command, the packages mentioned in the 'req.txt' file will be downloaded to 'my_dir' directory. pip download -r req.txt -d my_dir 5: If you wish to install packages from the 'my_dir' created above, use the command: pip install -r req.txt --find-links=my_dir 6: If you wish to skip installing the dependencies of a package and install the package alone: pip install --no-deps some-package-name 7: If you wish to skip re-installing a package that is already there: pip install --ignore-installed some-package-name 8: If you wish to force re-installing a package that is already there: pip install --upgrade some-package-name 9: If your packages are stored in multiple repositories, you can mention a second repository as given below: pip install some-package-name --extra-index-url=https://pypi.org/simple 10: If you wish to install the package to a specific directory, use the '-t' argument: pip install some-package-name -t D:\Python_Repository\Python38 Ref: Wikipedia ~ ~ ~
Pip, what is that?
Subscribe to:
Posts (Atom)
No comments:
Post a Comment