installing.rst 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. .. _`Installation`:
  2. Installation
  3. ============
  4. Do I need to install pip?
  5. -------------------------
  6. pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4
  7. downloaded from `python.org <https://www.python.org>`_ or if you are working
  8. in a :ref:`Virtual Environment <pypug:Creating and using Virtual Environments>`
  9. created by :ref:`pypug:virtualenv` or :ref:`pyvenv <pypug:venv>`.
  10. Just make sure to :ref:`upgrade pip <Upgrading pip>`.
  11. .. _`get-pip`:
  12. Installing with get-pip.py
  13. --------------------------
  14. To install pip, securely download `get-pip.py
  15. <https://bootstrap.pypa.io/get-pip.py>`_. [1]_::
  16. curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  17. As when running any script downloaded from the web, ensure that you have
  18. reviewed the code and are happy that it works as you expect.
  19. Then run the following::
  20. python get-pip.py
  21. .. warning::
  22. Be cautious if you are using a Python install that is managed by your operating
  23. system or another package manager. ``get-pip.py`` does not coordinate with
  24. those tools, and may leave your system in an inconsistent state.
  25. ``get-pip.py`` also installs :ref:`pypug:setuptools` [2]_ and :ref:`pypug:wheel`
  26. if they are not already. :ref:`pypug:setuptools` is required to install
  27. :term:`source distributions <pypug:Source Distribution (or "sdist")>`. Both are
  28. required in order to build a :ref:`Wheel cache` (which improves installation
  29. speed), although neither are required to install pre-built :term:`wheels
  30. <pypug:Wheel>`.
  31. .. note::
  32. The get-pip.py script is supported on the same python version as pip.
  33. For the now unsupported Python 2.6, alternate script is available
  34. `here <https://bootstrap.pypa.io/2.6/get-pip.py>`__.
  35. get-pip.py options
  36. ~~~~~~~~~~~~~~~~~~~
  37. .. option:: --no-setuptools
  38. If set, do not attempt to install :ref:`pypug:setuptools`
  39. .. option:: --no-wheel
  40. If set, do not attempt to install :ref:`pypug:wheel`
  41. ``get-pip.py`` allows :ref:`pip install options <pip
  42. install Options>` and the :ref:`general options <General Options>`. Below are
  43. some examples:
  44. Install from local copies of pip and setuptools::
  45. python get-pip.py --no-index --find-links=/local/copies
  46. Install to the user site [3]_::
  47. python get-pip.py --user
  48. Install behind a proxy::
  49. python get-pip.py --proxy="http://[user:passwd@]proxy.server:port"
  50. ``get-pip.py`` can also be used to install a specified combination of ``pip``,
  51. ``setuptools``, and ``wheel`` using the same requirements syntax as ``pip``::
  52. python get-pip.py pip==9.0.2 wheel==0.30.0 setuptools==28.8.0
  53. Using Linux Package Managers
  54. ----------------------------
  55. See :ref:`pypug:Installing pip/setuptools/wheel with Linux Package Managers` in
  56. the `Python Packaging User Guide
  57. <https://packaging.python.org/en/latest/current/>`_.
  58. .. _`Upgrading pip`:
  59. Upgrading pip
  60. -------------
  61. On Linux or macOS::
  62. pip install -U pip
  63. On Windows [4]_::
  64. python -m pip install -U pip
  65. .. _compatibility-requirements:
  66. Python and OS Compatibility
  67. ---------------------------
  68. pip works with CPython versions 2.7, 3.4, 3.5, 3.6, 3.7 and also pypy.
  69. This means pip works on the latest patch version of each of these minor
  70. versions. Previous patch versions are supported on a best effort approach.
  71. pip works on Unix/Linux, macOS, and Windows.
  72. ----
  73. .. [1] "Secure" in this context means using a modern browser or a
  74. tool like `curl` that verifies SSL certificates when downloading from
  75. https URLs.
  76. .. [2] Beginning with pip v1.5.1, ``get-pip.py`` stopped requiring setuptools to
  77. be installed first.
  78. .. [3] The pip developers are considering making ``--user`` the default for all
  79. installs, including ``get-pip.py`` installs of pip, but at this time,
  80. ``--user`` installs for pip itself, should not be considered to be fully
  81. tested or endorsed. For discussion, see `Issue 1668
  82. <https://github.com/pypa/pip/issues/1668>`_.
  83. .. [4] https://github.com/pypa/pip/issues/1299