README.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. ===============================
  2. Installing and Using Setuptools
  3. ===============================
  4. .. contents:: **Table of Contents**
  5. .. image:: https://setuptools.readthedocs.io/en/latest/?badge=latest
  6. :target: https://setuptools.readthedocs.io
  7. -------------------------
  8. Installation Instructions
  9. -------------------------
  10. The recommended way to bootstrap setuptools on any system is to download
  11. `ez_setup.py`_ and run it using the target Python environment. Different
  12. operating systems have different recommended techniques to accomplish this
  13. basic routine, so below are some examples to get you started.
  14. Setuptools requires Python 2.6 or later. To install setuptools
  15. on Python 2.4 or Python 2.5, use the `bootstrap script for Setuptools 1.x
  16. <https://raw.githubusercontent.com/pypa/setuptools/bootstrap-py24/ez_setup.py>`_.
  17. The link provided to ez_setup.py is a bookmark to bootstrap script for the
  18. latest known stable release.
  19. .. _ez_setup.py: https://bootstrap.pypa.io/ez_setup.py
  20. Windows (Powershell 3 or later)
  21. ===============================
  22. For best results, uninstall previous versions FIRST (see `Uninstalling`_).
  23. Using Windows 8 (which includes PowerShell 3) or earlier versions of Windows
  24. with PowerShell 3 installed, it's possible to install with one simple
  25. Powershell command. Start up Powershell and paste this command::
  26. > (Invoke-WebRequest https://bootstrap.pypa.io/ez_setup.py).Content | python -
  27. .. image:: https://badges.gitter.im/pypa/setuptools.svg
  28. :alt: Join the chat at https://gitter.im/pypa/setuptools
  29. :target: https://gitter.im/pypa/setuptools?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
  30. You must start the Powershell with Administrative privileges or you may choose
  31. to install a user-local installation::
  32. > (Invoke-WebRequest https://bootstrap.pypa.io/ez_setup.py).Content | python - --user
  33. If you have Python 3.3 or later, you can use the ``py`` command to install to
  34. different Python versions. For example, to install to Python 3.3 if you have
  35. Python 2.7 installed::
  36. > (Invoke-WebRequest https://bootstrap.pypa.io/ez_setup.py).Content | py -3 -
  37. The recommended way to install setuptools on Windows is to download
  38. `ez_setup.py`_ and run it. The script will download the appropriate
  39. distribution file and install it for you.
  40. Once installation is complete, you will find an ``easy_install`` program in
  41. your Python ``Scripts`` subdirectory. For simple invocation and best results,
  42. add this directory to your ``PATH`` environment variable, if it is not already
  43. present. If you did a user-local install, the ``Scripts`` subdirectory is
  44. ``$env:APPDATA\Python\Scripts``.
  45. Windows (simplified)
  46. ====================
  47. For Windows without PowerShell 3 or for installation without a command-line,
  48. download `ez_setup.py`_ using your preferred web browser or other technique
  49. and "run" that file.
  50. Unix (wget)
  51. ===========
  52. Most Linux distributions come with wget.
  53. Download `ez_setup.py`_ and run it using the target Python version. The script
  54. will download the appropriate version and install it for you::
  55. > wget https://bootstrap.pypa.io/ez_setup.py -O - | python
  56. Note that you will may need to invoke the command with superuser privileges to
  57. install to the system Python::
  58. > wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python
  59. Alternatively, Setuptools may be installed to a user-local path::
  60. > wget https://bootstrap.pypa.io/ez_setup.py -O - | python - --user
  61. Note that on some older systems (noted on Debian 6 and CentOS 5 installations),
  62. `wget` may refuse to download `ez_setup.py`, complaining that the certificate common name `*.c.ssl.fastly.net`
  63. does not match the host name `bootstrap.pypa.io`. In addition, the `ez_setup.py` script may then encounter similar problems using
  64. `wget` internally to download `setuptools-x.y.zip`, complaining that the certificate common name of `www.python.org` does not match the
  65. host name `pypi.python.org`. Those are known issues, related to a bug in the older versions of `wget`
  66. (see `Issue 59 <https://bitbucket.org/pypa/pypi/issue/59#comment-5881915>`_). If you happen to encounter them,
  67. install Setuptools as follows::
  68. > wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
  69. > python ez_setup.py --insecure
  70. Unix including Mac OS X (curl)
  71. ==============================
  72. If your system has curl installed, follow the ``wget`` instructions but
  73. replace ``wget`` with ``curl`` and ``-O`` with ``-o``. For example::
  74. > curl https://bootstrap.pypa.io/ez_setup.py -o - | python
  75. Advanced Installation
  76. =====================
  77. For more advanced installation options, such as installing to custom
  78. locations or prefixes, download and extract the source
  79. tarball from `Setuptools on PyPI <https://pypi.python.org/pypi/setuptools>`_
  80. and run setup.py with any supported distutils and Setuptools options.
  81. For example::
  82. setuptools-x.x$ python setup.py install --prefix=/opt/setuptools
  83. Use ``--help`` to get a full options list, but we recommend consulting
  84. the `EasyInstall manual`_ for detailed instructions, especially `the section
  85. on custom installation locations`_.
  86. .. _EasyInstall manual: https://pythonhosted.org/setuptools/EasyInstall
  87. .. _the section on custom installation locations: https://pythonhosted.org/setuptools/EasyInstall#custom-installation-locations
  88. Downloads
  89. =========
  90. All setuptools downloads can be found at `the project's home page in the Python
  91. Package Index`_. Scroll to the very bottom of the page to find the links.
  92. .. _the project's home page in the Python Package Index: https://pypi.python.org/pypi/setuptools
  93. In addition to the PyPI downloads, the development version of ``setuptools``
  94. is available from the `Bitbucket repo`_, and in-development versions of the
  95. `0.6 branch`_ are available as well.
  96. .. _Bitbucket repo: https://bitbucket.org/pypa/setuptools/get/default.tar.gz#egg=setuptools-dev
  97. .. _0.6 branch: http://svn.python.org/projects/sandbox/branches/setuptools-0.6/#egg=setuptools-dev06
  98. Uninstalling
  99. ============
  100. On Windows, if Setuptools was installed using an ``.exe`` or ``.msi``
  101. installer, simply use the uninstall feature of "Add/Remove Programs" in the
  102. Control Panel.
  103. Otherwise, to uninstall Setuptools or Distribute, regardless of the Python
  104. version, delete all ``setuptools*`` and ``distribute*`` files and
  105. directories from your system's ``site-packages`` directory
  106. (and any other ``sys.path`` directories) FIRST.
  107. If you are upgrading or otherwise plan to re-install Setuptools or Distribute,
  108. nothing further needs to be done. If you want to completely remove Setuptools,
  109. you may also want to remove the 'easy_install' and 'easy_install-x.x' scripts
  110. and associated executables installed to the Python scripts directory.
  111. --------------------------------
  112. Using Setuptools and EasyInstall
  113. --------------------------------
  114. Here are some of the available manuals, tutorials, and other resources for
  115. learning about Setuptools, Python Eggs, and EasyInstall:
  116. * `The EasyInstall user's guide and reference manual`_
  117. * `The setuptools Developer's Guide`_
  118. * `The pkg_resources API reference`_
  119. * `The Internal Structure of Python Eggs`_
  120. Questions, comments, and bug reports should be directed to the `distutils-sig
  121. mailing list`_. If you have written (or know of) any tutorials, documentation,
  122. plug-ins, or other resources for setuptools users, please let us know about
  123. them there, so this reference list can be updated. If you have working,
  124. *tested* patches to correct problems or add features, you may submit them to
  125. the `setuptools bug tracker`_.
  126. .. _setuptools bug tracker: https://github.com/pypa/setuptools/issues
  127. .. _The Internal Structure of Python Eggs: https://setuptools.readthedocs.io/en/latest/formats.html
  128. .. _The setuptools Developer's Guide: https://setuptools.readthedocs.io/en/latest/developer-guide.html
  129. .. _The pkg_resources API reference: https://setuptools.readthedocs.io/en/latest/pkg_resources.html
  130. .. _The EasyInstall user's guide and reference manual: https://setuptools.readthedocs.io/en/latest/easy_install.html
  131. .. _distutils-sig mailing list: http://mail.python.org/pipermail/distutils-sig/
  132. -------
  133. Credits
  134. -------
  135. * The original design for the ``.egg`` format and the ``pkg_resources`` API was
  136. co-created by Phillip Eby and Bob Ippolito. Bob also implemented the first
  137. version of ``pkg_resources``, and supplied the OS X operating system version
  138. compatibility algorithm.
  139. * Ian Bicking implemented many early "creature comfort" features of
  140. easy_install, including support for downloading via Sourceforge and
  141. Subversion repositories. Ian's comments on the Web-SIG about WSGI
  142. application deployment also inspired the concept of "entry points" in eggs,
  143. and he has given talks at PyCon and elsewhere to inform and educate the
  144. community about eggs and setuptools.
  145. * Jim Fulton contributed time and effort to build automated tests of various
  146. aspects of ``easy_install``, and supplied the doctests for the command-line
  147. ``.exe`` wrappers on Windows.
  148. * Phillip J. Eby is the seminal author of setuptools, and
  149. first proposed the idea of an importable binary distribution format for
  150. Python application plug-ins.
  151. * Significant parts of the implementation of setuptools were funded by the Open
  152. Source Applications Foundation, to provide a plug-in infrastructure for the
  153. Chandler PIM application. In addition, many OSAF staffers (such as Mike
  154. "Code Bear" Taylor) contributed their time and stress as guinea pigs for the
  155. use of eggs and setuptools, even before eggs were "cool". (Thanks, guys!)
  156. * Tarek Ziadé is the principal author of the Distribute fork, which
  157. re-invigorated the community on the project, encouraged renewed innovation,
  158. and addressed many defects.
  159. * Since the merge with Distribute, Jason R. Coombs is the
  160. maintainer of setuptools. The project is maintained in coordination with
  161. the Python Packaging Authority (PyPA) and the larger Python community.
  162. .. _files:
  163. ---------------
  164. Code of Conduct
  165. ---------------
  166. Everyone interacting in the setuptools project's codebases, issue trackers,
  167. chat rooms, and mailing lists is expected to follow the
  168. `PyPA Code of Conduct`_.
  169. .. _PyPA Code of Conduct: https://www.pypa.io/en/latest/code-of-conduct/