Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

199 lignes
7.5 KiB

il y a 11 ans
  1. # python-build
  2. python-build is a [pyenv](https://github.com/yyuu/pyenv) plugin
  3. that provides a `pyenv install` command to compile and install
  4. different versions of Python on UNIX-like systems.
  5. You can also use python-build without pyenv in environments where you
  6. need precise control over Python version installation.
  7. ## Installation
  8. ### Installing as an pyenv plugin (recommended)
  9. You need nothing to do since python-build is bundled with pyenv by
  10. default.
  11. ### Installing as a standalone program (advanced)
  12. Installing python-build as a standalone program will give you access to
  13. the `python-build` command for precise control over Python version
  14. installation. If you have pyenv installed, you will also be able to
  15. use the `pyenv install` command.
  16. git clone git://github.com/yyuu/pyenv.git
  17. cd pyenv/plugins/python-build
  18. ./install.sh
  19. This will install python-build into `/usr/local`. If you do not have
  20. write permission to `/usr/local`, you will need to run `sudo
  21. ./install.sh` instead. You can install to a different prefix by
  22. setting the `PREFIX` environment variable.
  23. To update python-build after it has been installed, run `git pull` in
  24. your cloned copy of the repository, then re-run the install script.
  25. ## Usage
  26. ### Using `pyenv install` with pyenv
  27. To install a Python version for use with pyenv, run `pyenv install` with
  28. the exact name of the version you want to install. For example,
  29. pyenv install 2.7.4
  30. Python versions will be installed into a directory of the same name
  31. under `~/.pyenv/versions`.
  32. To see a list of all available Python versions, run `pyenv install --list`.
  33. You may also tab-complete available Python
  34. versions if your pyenv installation is properly configured.
  35. ### Using `python-build` standalone
  36. If you have installed python-build as a standalone program, you can use
  37. the `python-build` command to compile and install Python versions into
  38. specific locations.
  39. Run the `python-build` command with the exact name of the version you
  40. want to install and the full path where you want to install it. For
  41. example,
  42. python-build 2.7.4 ~/local/python-2.7.4
  43. To see a list of all available Python versions, run `python-build
  44. --definitions`.
  45. Pass the `-v` or `--verbose` flag to `python-build` as the first
  46. argument to see what's happening under the hood.
  47. ### Custom definitions
  48. Both `pyenv install` and `python-build` accept a path to a custom
  49. definition file in place of a version name. Custom definitions let you
  50. develop and install versions of Python that are not yet supported by
  51. python-build.
  52. See the [python-build built-in
  53. definitions](https://github.com/yyuu/pyenv/tree/master/plugins/python-build/share/python-build)
  54. as a starting point for custom definition files.
  55. ### Special environment variables
  56. You can set certain environment variables to control the build
  57. process.
  58. * `TMPDIR` sets the location where python-build stores temporary files.
  59. * `PYTHON_BUILD_BUILD_PATH` sets the location in which sources are
  60. downloaded and built. By default, this is a subdirectory of
  61. `TMPDIR`.
  62. * `PYTHON_BUILD_CACHE_PATH`, if set, specifies a directory to use for
  63. caching downloaded package files.
  64. * `PYTHON_BUILD_MIRROR_URL` overrides the default mirror URL root to one
  65. of your choosing.
  66. * `PYTHON_BUILD_SKIP_MIRROR`, if set, forces python-build to download
  67. packages from their original source URLs instead of using a mirror.
  68. * `CC` sets the path to the C compiler.
  69. * `CONFIGURE_OPTS` lets you pass additional options to `./configure`.
  70. * `MAKE` lets you override the command to use for `make`. Useful for
  71. specifying GNU make (`gmake`) on some systems.
  72. * `MAKE_OPTS` (or `MAKEOPTS`) lets you pass additional options to
  73. `make`.
  74. * `PYTHON_CONFIGURE_OPTS` and `PYTHON_MAKE_OPTS` allow you to specify
  75. configure and make options for buildling CPython. These variables will
  76. be passed to Python only, not any dependent packages (e.g. libyaml).
  77. ### Checksum verification
  78. If you have the `shasum`, `openssl`, or `sha256sum` tool installed,
  79. python-build will automatically verify the SHA2 checksum of each
  80. downloaded package before installing it.
  81. Checksums are optional and specified as anchors on the package URL in
  82. each definition. (All bundled definitions include checksums.)
  83. ### Package download mirrors
  84. python-build will first attempt to download package files from a mirror
  85. hosted on Amazon CloudFront. If a package is not available on the
  86. mirror, if the mirror is down, or if the download is corrupt,
  87. python-build will fall back to the official URL specified in the
  88. defintion file.
  89. You can point python-build to another mirror by specifying the
  90. `PYTHON_BUILD_MIRROR_URL` environment variable--useful if you'd like to
  91. run your own local mirror, for example. Package mirror URLs are
  92. constructed by joining this variable with the SHA2 checksum of the
  93. package file.
  94. If you don't have an SHA2 program installed, python-build will skip the
  95. download mirror and use official URLs instead. You can force
  96. python-build to bypass the mirror by setting the
  97. `PYTHON_BUILD_SKIP_MIRROR` environment variable.
  98. The official python-build download mirror is provided by [Git Hub Pages](http://yyuu.github.io/pythons/).
  99. ### Package download caching
  100. You can instruct python-build to keep a local cache of downloaded
  101. package files by setting the `PYTHON_BUILD_CACHE_PATH` environment
  102. variable. When set, package files will be kept in this directory after
  103. the first successful download and reused by subsequent invocations of
  104. `python-build` and `pyenv install`.
  105. The `pyenv install` command defaults this path to `~/.pyenv/cache`, so
  106. in most cases you can enable download caching simply by creating that
  107. directory.
  108. ### Keeping the build directory after installation
  109. Both `python-build` and `pyenv install` accept the `-k` or `--keep`
  110. flag, which tells python-build to keep the downloaded source after
  111. installation. This can be useful if you need to use `gdb` and
  112. `memprof` with Python.
  113. Source code will be kept in a parallel directory tree
  114. `~/.pyenv/sources` when using `--keep` with the `pyenv install`
  115. command. You should specify the location of the source code with the
  116. `PYTHON_BUILD_BUILD_PATH` environment variable when using `--keep` with
  117. `python-build`.
  118. ## Getting Help
  119. Please see the [python-build
  120. wiki](https://github.com/yyuu/pyenv/wiki) for solutions to
  121. common problems.
  122. If you can't find an answer on the wiki, open an issue on the [issue
  123. tracker](https://github.com/yyuu/pyenv/issues). Be sure to
  124. include the full build log for build failures.
  125. ### License
  126. (The MIT License)
  127. * Copyright (c) 2013 Yamashita, Yuu
  128. * Copyright (c) 2012 Sam Stephenson
  129. Permission is hereby granted, free of charge, to any person obtaining
  130. a copy of this software and associated documentation files (the
  131. "Software"), to deal in the Software without restriction, including
  132. without limitation the rights to use, copy, modify, merge, publish,
  133. distribute, sublicense, and/or sell copies of the Software, and to
  134. permit persons to whom the Software is furnished to do so, subject to
  135. the following conditions:
  136. The above copyright notice and this permission notice shall be
  137. included in all copies or substantial portions of the Software.
  138. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  139. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  140. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  141. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  142. LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  143. OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  144. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.