banner



How To Install Pip In Python 2.7

Pip is the standard package manager for Python. It enables the installation and management of third political party packages that provide features and functionality non contained in the Python standard library . Newer versions of Python (Python 2 >= v2.7.9 or Python three >= v3.four) come prepackaged with pip by default. Pip is too included in the virtual environments created by virtualenv and pyvenv.

But if you lot're using an older version of Python, pip will need to be manually installed. This tutorial steps through how to install Pip on Windows, and explains how to continue it updated.

Prerequisites for Pip Installation

  1. Check if pip is already installed by running the following on the command line:
          pip --version        

or

          pip -V        

If pip is installed, you lot'll see something like to the following output:

          C:usersjdoe>pip --version          Pip 19.2.3 from c:usersjdoeappdatalocalprogramspythonpython38-32libsite-packagespip (python 3.8)        
  1. Verify that Python is installed. If pip is non installed, yous can confirm that Python is available on your local machine and decide the version by running the following command:
          python --version        

You should see something like the post-obit if Python is installed:

          C:usersjdoe>pip --version                    Python 3.8.0        

If you practise non have a version of Python installed, you can quickly download and install a recent version of ActivePython .

How to Install Pip with get-pip.py

  1. To manually install pip on Windows, you will need a copy of become-pip.py .  For older Python versions, you lot may need to utilise the appropriate version of the file from pypa.org . Download the file to a folder on your computer, or use the curl command:
          curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py        
  1. Next, run the post-obit command to install pip:
          python get          -          pip          .          py        

If the file is not constitute, you may need to first navigate to the directory containing the  get-pip.py file. On installation, you should see something similar to the following:

          Installing collected packages: pip, setuptools, bicycle          The script bicycle.exe is installed in 'C:Python33Scripts' which is not on PATH.          Consider calculation this directory to PATH or, if yous prefer to suppress this alert, use --no-warn-script-location.          Successfully installed pip-10.0.1 setuptools-39.2.0 bicycle-0.29.0        

This command volition as well install setuptools and wheel if they are not already installed. Setuptools is a suite of configuration enhancements to the Python distutils that facilitates building Python distributions. It is required to install source distributions, or "sdists," a distribution format that provides the metadata and source files needed for tools like pip.

  1. Verify that pip is installed by running the previous command to cheque the version. Navigate to the installation location (C:Python33Scripts by default) and run:
          pip --version        

For farther instructions on how to install packages with pip, refer to our guide to Python Packet Installation on Windows

Adding PIP to Windows Environment Variables

I of the most mutual issues with running Python tools like pip is the "not on PATH" fault. This means that Python cannot find the tool you're trying to run in your electric current directory. In most cases, you'll need to navigate to the directory in which the tool is installed before you can run the command to launch it.

If you'd rather run pip (or other tools) from any location, you'll demand to add the directory in which it'south installed as a PATH environment variable by doing the following:

  1. Open upward the Control Console and navigate to System and Security > Organisation
  2. Click on the Avant-garde arrangement settings link on the left console
  3. Click Environment Variables .
  4. Under System Variables , double-click the variable PATH.
  5. Click New , and add the directory where pip is installed, e.thou. C:Python33Scripts, and select OK.

How to Install Pip on Windows Environment Variables

Upgrading Pip on Windows

Pip is a key tool in the Python ecosystem, and equally such is updated on a regular basis. Changes can ever exist plant in the release notes for each version. In order to keep your version of pip up to engagement, you can run the following on the command line:

          python -one thousand pip install -U pip        

This command will uninstall the outdated version of pip first, and so download the most current iteration.

It'south likewise possible to downgrade to a previous version of pip, in case a newer version is causing unexpected compatibility errors. For example, to downgrade to pip v18.0 run the following command:

          python -k pip install pip==eighteen.0                  

Next Steps

Attempt the ActiveState Platform to build Python packages faster and safer. Create a custom Python runtime for your adjacent project. Pick merely the packages you lot demand, and we'll automatically resolve all dependencies, build it (including C lawmaking) and packet information technology for your platform.


How ActiveState Can Assistance

ActiveState provides a unified cantankerous-platform toolchain for modern Python bundle management. Information technology can replace the complex and difficult-to-maintain in-house solutions built from multiple package managers, environment management tools and other solutions.

By adopting the ActiveState Platform, developers can:

  • Automatic edifice of packages from source, including link C libraries without the need for a local build environment.
  • Automated resolution of dependencies (or suggestions on how to manually resolve conflicts), ensuring that your environment ever contains a set of known skillful dependencies that work together.
  • Central management of a single source of truth for your environment that tin can be deployed with a single command to all development and CI/CD environments, ensuring consistent reproducibility.
  • Automated installation of virtual Python environments on Windows or Linux without requiring prior setup.
  • The ability to find, fix and automatically rebuild vulnerable environments, thereby enhancing security and dramatically reducing time and effort involved in resolving CVEs.
  • Visually seeing which versions of which packages are approved for use, thereby taking the guesswork out of development.

Those that prefer to work from the command line tin leverage the ActiveState Platform's CLI, the State Tool, which acts every bit a universal package manager for Python, and provides access to near of the features offered by the Platform.

Python Package management

Modernistic Python Package Management

ActiveState provides a unified cantankerous-platform toolchain for modern Python package direction. It can supervene upon the circuitous and hard-to-maintain in-firm solutions built from multiple package managers, environment management tools and other solutions.

By adopting the ActiveState Platform, developers can:

  • Increase the security of Python environments
  • Improve the transparency of your open source supply chain
  • Dramatically reduce package and environment direction overhead
  • Eliminate dependency hell
  • Reduce "works on my machine" problems

Ultimately, developers that are willing to adopt the ActiveState Platform will spend less time wrestling with tooling and more time focused on doing what they do best: coding.

To try the ActiveState Platform for yourself, sign-upward for a complimentary account.

Source: https://www.activestate.com/resources/quick-reads/how-to-install-pip-on-windows/

Posted by: jacobstruessen.blogspot.com

0 Response to "How To Install Pip In Python 2.7"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel