Installing Pip Is Not Working in Python ≪ 3.6

How to install PIP on Python 3.6?

pip is bundled with Python > 3.4

On Unix-like systems use:

python3.6 -m pip install [Package_to_install]

On a Windows system use:

py -m pip install [Package_to_install]

(On Windows you may need to run the command prompt as administrator to be able to write into python installation directory)

Installing pip is not working in python < 3.6

pip 21.0 dropped support for Python 2 and 3.5. The later versions require Python 3.6+. The syntax f"" is supported by Python 3.6+.

To install pip for Python 2.7 install it from https://bootstrap.pypa.io/pip/2.7/ :

- curl -O https://bootstrap.pypa.io/pip/2.7/get-pip.py
- python get-pip.py
- python -m pip install --upgrade "pip < 21.0"

The last command is to upgrade to the latest supported version.

  • For Python 2.7 the latest supported is currently pip 20.3.4.
  • For Python 3.6 install from https://bootstrap.pypa.io/pip/3.6/
  • For Python 3.5 install from https://bootstrap.pypa.io/pip/3.5/
  • For Python 3.4 install from https://bootstrap.pypa.io/pip/3.4/
  • For Python 3.4 the upgrade command is
    python -m pip install --upgrade "pip < 19.2"

pip' is not recognized as an internal or external command

You need to add the path of your pip installation to your PATH system variable. By default, pip is installed to C:\Python34\Scripts\pip (pip now comes bundled with new versions of python), so the path "C:\Python34\Scripts" needs to be added to your PATH variable.

To check if it is already in your PATH variable, type echo %PATH% at the CMD prompt

To add the path of your pip installation to your PATH variable, you can use the Control Panel or the setx command. For example:

setx PATH "%PATH%;C:\Python34\Scripts"

Note:
According to the official documentation, "[v]ariables set with setx variables are available in future command windows only, not in the current command window". In particular, you will need to start a new cmd.exe instance after entering the above command in order to utilize the new environment variable.

Thanks to Scott Bartell for pointing this out.



Related Topics



Leave a reply



Submit