2013-01-18 22:25:15 +01:00
|
|
|
.. _`Installation`:
|
2011-03-15 06:43:03 +01:00
|
|
|
|
2013-01-18 22:25:15 +01:00
|
|
|
Installation
|
|
|
|
============
|
|
|
|
|
2015-09-08 01:56:10 +02:00
|
|
|
Do I need to install pip?
|
|
|
|
-------------------------
|
2013-02-11 07:44:09 +01:00
|
|
|
|
2018-07-02 16:28:13 +02:00
|
|
|
pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4
|
|
|
|
downloaded from `python.org <https://www.python.org>`_ or if you are working
|
|
|
|
in a :ref:`Virtual Environment <pypug:Creating and using Virtual Environments>`
|
|
|
|
created by :ref:`pypug:virtualenv` or :ref:`pyvenv <pypug:venv>`.
|
2017-07-27 21:04:04 +02:00
|
|
|
Just make sure to :ref:`upgrade pip <Upgrading pip>`.
|
2013-03-12 06:02:39 +01:00
|
|
|
|
|
|
|
|
2014-01-10 05:13:30 +01:00
|
|
|
.. _`get-pip`:
|
|
|
|
|
2015-09-08 01:56:10 +02:00
|
|
|
Installing with get-pip.py
|
|
|
|
--------------------------
|
2014-01-10 05:13:30 +01:00
|
|
|
|
2019-10-16 02:09:07 +02:00
|
|
|
To install pip, securely [1]_ download ``get-pip.py`` by following
|
|
|
|
this link: `get-pip.py
|
|
|
|
<https://bootstrap.pypa.io/get-pip.py>`_. Alternatively, use ``curl``::
|
2014-01-10 05:13:30 +01:00
|
|
|
|
2017-07-27 21:04:04 +02:00
|
|
|
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
2014-01-10 05:13:30 +01:00
|
|
|
|
2019-10-16 02:09:07 +02:00
|
|
|
Then run the following command in the folder where you
|
|
|
|
have downloaded ``get-pip.py``::
|
2014-01-10 05:13:30 +01:00
|
|
|
|
2014-03-26 19:05:23 +01:00
|
|
|
python get-pip.py
|
2014-01-10 05:13:30 +01:00
|
|
|
|
|
|
|
|
2015-09-08 01:56:10 +02:00
|
|
|
.. warning::
|
|
|
|
|
2017-07-27 21:04:04 +02:00
|
|
|
Be cautious if you are using a Python install that is managed by your operating
|
|
|
|
system or another package manager. ``get-pip.py`` does not coordinate with
|
2015-09-08 01:56:10 +02:00
|
|
|
those tools, and may leave your system in an inconsistent state.
|
|
|
|
|
2018-07-02 16:28:13 +02:00
|
|
|
``get-pip.py`` also installs :ref:`pypug:setuptools` [2]_ and :ref:`pypug:wheel`
|
2017-07-27 21:04:04 +02:00
|
|
|
if they are not already. :ref:`pypug:setuptools` is required to install
|
2015-09-08 01:56:10 +02:00
|
|
|
:term:`source distributions <pypug:Source Distribution (or "sdist")>`. Both are
|
2017-07-27 21:04:04 +02:00
|
|
|
required in order to build a :ref:`Wheel cache` (which improves installation
|
2015-09-08 01:56:10 +02:00
|
|
|
speed), although neither are required to install pre-built :term:`wheels
|
|
|
|
<pypug:Wheel>`.
|
|
|
|
|
2016-07-17 11:55:48 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
The get-pip.py script is supported on the same python version as pip.
|
2017-03-18 19:42:11 +01:00
|
|
|
For the now unsupported Python 2.6, alternate script is available
|
2016-11-07 00:48:35 +01:00
|
|
|
`here <https://bootstrap.pypa.io/2.6/get-pip.py>`__.
|
2016-07-17 11:55:48 +02:00
|
|
|
|
2015-09-08 01:56:10 +02:00
|
|
|
|
|
|
|
get-pip.py options
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
.. option:: --no-setuptools
|
|
|
|
|
2017-07-27 21:04:04 +02:00
|
|
|
If set, do not attempt to install :ref:`pypug:setuptools`
|
2015-09-08 01:56:10 +02:00
|
|
|
|
|
|
|
.. option:: --no-wheel
|
|
|
|
|
2017-07-27 21:04:04 +02:00
|
|
|
If set, do not attempt to install :ref:`pypug:wheel`
|
2015-09-08 01:56:10 +02:00
|
|
|
|
2014-04-10 01:53:52 +02:00
|
|
|
|
2017-07-27 21:04:04 +02:00
|
|
|
``get-pip.py`` allows :ref:`pip install options <pip
|
2014-04-10 01:53:52 +02:00
|
|
|
install Options>` and the :ref:`general options <General Options>`. Below are
|
|
|
|
some examples:
|
2014-04-09 07:57:22 +02:00
|
|
|
|
2014-04-10 01:53:52 +02:00
|
|
|
Install from local copies of pip and setuptools::
|
2014-04-09 07:57:22 +02:00
|
|
|
|
|
|
|
python get-pip.py --no-index --find-links=/local/copies
|
|
|
|
|
2017-05-16 20:18:27 +02:00
|
|
|
Install to the user site [3]_::
|
2014-04-09 07:57:22 +02:00
|
|
|
|
2014-04-10 01:53:52 +02:00
|
|
|
python get-pip.py --user
|
2011-04-04 16:45:07 +02:00
|
|
|
|
2014-04-10 01:53:52 +02:00
|
|
|
Install behind a proxy::
|
2013-08-29 05:43:20 +02:00
|
|
|
|
2016-04-28 07:40:10 +02:00
|
|
|
python get-pip.py --proxy="http://[user:passwd@]proxy.server:port"
|
2014-04-09 07:57:22 +02:00
|
|
|
|
2018-03-17 12:23:47 +01:00
|
|
|
``get-pip.py`` can also be used to install a specified combination of ``pip``,
|
2019-05-07 15:13:56 +02:00
|
|
|
``setuptools``, and ``wheel`` using the same requirements syntax as pip::
|
2018-03-17 12:23:47 +01:00
|
|
|
|
|
|
|
python get-pip.py pip==9.0.2 wheel==0.30.0 setuptools==28.8.0
|
|
|
|
|
2014-04-09 07:57:22 +02:00
|
|
|
|
2015-09-24 01:58:20 +02:00
|
|
|
Using Linux Package Managers
|
|
|
|
----------------------------
|
2015-09-08 01:56:10 +02:00
|
|
|
|
2015-09-24 01:58:20 +02:00
|
|
|
See :ref:`pypug:Installing pip/setuptools/wheel with Linux Package Managers` in
|
|
|
|
the `Python Packaging User Guide
|
2019-12-10 23:18:38 +01:00
|
|
|
<https://packaging.python.org/guides/tool-recommendations/>`_.
|
2015-09-08 01:56:10 +02:00
|
|
|
|
2015-09-12 05:24:44 +02:00
|
|
|
.. _`Upgrading pip`:
|
|
|
|
|
|
|
|
Upgrading pip
|
|
|
|
-------------
|
2014-03-26 19:05:23 +01:00
|
|
|
|
2017-07-27 21:04:04 +02:00
|
|
|
On Linux or macOS::
|
2014-03-26 19:05:23 +01:00
|
|
|
|
|
|
|
pip install -U pip
|
|
|
|
|
|
|
|
|
2017-07-27 21:04:04 +02:00
|
|
|
On Windows [4]_::
|
2014-03-26 19:05:23 +01:00
|
|
|
|
|
|
|
python -m pip install -U pip
|
|
|
|
|
|
|
|
|
2018-07-02 16:28:13 +02:00
|
|
|
.. _compatibility-requirements:
|
|
|
|
|
2015-09-08 01:56:10 +02:00
|
|
|
Python and OS Compatibility
|
|
|
|
---------------------------
|
2014-03-26 19:05:23 +01:00
|
|
|
|
2019-10-15 19:06:29 +02:00
|
|
|
pip works with CPython versions 2.7, 3.5, 3.6, 3.7, 3.8 and also PyPy.
|
2011-03-15 06:43:03 +01:00
|
|
|
|
2017-03-18 19:42:11 +01:00
|
|
|
This means pip works on the latest patch version of each of these minor
|
|
|
|
versions. Previous patch versions are supported on a best effort approach.
|
2016-01-03 23:44:40 +01:00
|
|
|
|
2016-11-06 18:24:43 +01:00
|
|
|
pip works on Unix/Linux, macOS, and Windows.
|
2011-04-04 17:37:30 +02:00
|
|
|
|
2011-03-15 06:43:03 +01:00
|
|
|
|
2014-03-26 19:05:23 +01:00
|
|
|
----
|
2013-02-11 07:44:09 +01:00
|
|
|
|
2017-05-16 20:18:27 +02:00
|
|
|
.. [1] "Secure" in this context means using a modern browser or a
|
2019-09-24 14:01:33 +02:00
|
|
|
tool like ``curl`` that verifies SSL certificates when downloading from
|
2013-08-29 05:43:20 +02:00
|
|
|
https URLs.
|
|
|
|
|
2017-05-16 20:18:27 +02:00
|
|
|
.. [2] Beginning with pip v1.5.1, ``get-pip.py`` stopped requiring setuptools to
|
2014-02-12 07:13:03 +01:00
|
|
|
be installed first.
|
2011-03-15 06:43:03 +01:00
|
|
|
|
2017-05-16 20:18:27 +02:00
|
|
|
.. [3] The pip developers are considering making ``--user`` the default for all
|
2014-04-10 01:53:52 +02:00
|
|
|
installs, including ``get-pip.py`` installs of pip, but at this time,
|
|
|
|
``--user`` installs for pip itself, should not be considered to be fully
|
|
|
|
tested or endorsed. For discussion, see `Issue 1668
|
|
|
|
<https://github.com/pypa/pip/issues/1668>`_.
|
|
|
|
|
2017-05-16 20:18:27 +02:00
|
|
|
.. [4] https://github.com/pypa/pip/issues/1299
|