Changeset 391 for python/trunk/Doc/install/index.rst
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Doc/install/index.rst
r2 r391 8 8 9 9 :Author: Greg Ward 10 :Release: |version|11 :Date: |today|12 10 13 11 .. TODO: Fill in XXX comments … … 73 71 --install`` it if it's an RPM, etc. You don't need to run Python or a setup 74 72 script, you don't need to compile anything---you might not even need to read any 75 instructions (although it's always a good idea to do so anyway s).73 instructions (although it's always a good idea to do so anyway). 76 74 77 75 Of course, things will not always be that easy. You might be interested in a … … 97 95 distribution will contain a setup script :file:`setup.py`, and a file named 98 96 :file:`README.txt` or possibly just :file:`README`, which should explain that 99 building and installing the module distribution is a simple matter of running :: 97 building and installing the module distribution is a simple matter of running 98 one command from a terminal:: 100 99 101 100 python setup.py install 101 102 For Windows, this command should be run from a command prompt window 103 (:menuselection:`Start --> Accessories`):: 104 105 setup.py install 102 106 103 107 If all these things are true, then you already know how to build and install the … … 114 118 115 119 As described in section :ref:`inst-new-standard`, building and installing a module 116 distribution using the Distutils is usually one simple command:: 120 distribution using the Distutils is usually one simple command to run from a 121 terminal:: 117 122 118 123 python setup.py install 119 120 On Unix, you'd run this command from a shell prompt; on Windows, you have to121 open a command prompt window ("DOS box") and do it there; on Mac OS X, you open122 a :command:`Terminal` window to get a shell prompt.123 124 124 125 … … 142 143 graphical user interface (such as WinZip) or a command-line tool (such as 143 144 :program:`unzip` or :program:`pkunzip`) to unpack the archive. Then, open a 144 command prompt window ("DOS box"),and run::145 command prompt window and run:: 145 146 146 147 cd c:\Temp\foo-1.0 … … 189 190 :option:`--build-base` option. For example:: 190 191 191 python setup.py build --build-base=/ tmp/pybuild/foo-1.0192 python setup.py build --build-base=/path/to/pybuild/foo-1.0 192 193 193 194 (Or you could do this permanently with a directive in your system or personal … … 235 236 is pure Python or contains extensions ("non-pure"): 236 237 238 .. tabularcolumns:: |l|l|l|l| 239 237 240 +-----------------+-----------------------------------------------------+--------------------------------------------------+-------+ 238 241 | Platform | Standard installation location | Default value | Notes | … … 242 245 | Unix (non-pure) | :file:`{exec-prefix}/lib/python{X.Y}/site-packages` | :file:`/usr/local/lib/python{X.Y}/site-packages` | \(1) | 243 246 +-----------------+-----------------------------------------------------+--------------------------------------------------+-------+ 244 | Windows | :file:`{prefix} ` | :file:`C:\\Python`| \(2) |247 | Windows | :file:`{prefix}\\Lib\\site-packages` | :file:`C:\\Python{XY}\\Lib\\site-packages` | \(2) | 245 248 +-----------------+-----------------------------------------------------+--------------------------------------------------+-------+ 246 249 … … 277 280 '/usr' 278 281 282 A few other placeholders are used in this document: :file:`{X.Y}` stands for the 283 version of Python, for example ``2.7``; :file:`{distname}` will be replaced by 284 the name of the module distribution being installed. Dots and capitalization 285 are important in the paths; for example, a value that uses ``python2.7`` on UNIX 286 will typically use ``Python27`` on Windows. 287 279 288 If you don't want to install modules to the standard location, or if you don't 280 289 have permission to write there, then you need to read about alternate … … 305 314 you. 306 315 307 308 .. _inst-alt-install-prefix: 316 Note that the various alternate installation schemes are mutually exclusive: you 317 can pass ``--user``, or ``--home``, or ``--prefix`` and ``--exec-prefix``, or 318 ``--install-base`` and ``--install-platbase``, but you can't mix from these 319 groups. 320 321 322 .. _inst-alt-install-user: 323 324 Alternate installation: the user scheme 325 --------------------------------------- 326 327 This scheme is designed to be the most convenient solution for users that don't 328 have write permission to the global site-packages directory or don't want to 329 install into it. It is enabled with a simple option:: 330 331 python setup.py install --user 332 333 Files will be installed into subdirectories of :data:`site.USER_BASE` (written 334 as :file:`{userbase}` hereafter). This scheme installs pure Python modules and 335 extension modules in the same location (also known as :data:`site.USER_SITE`). 336 Here are the values for UNIX, including Mac OS X: 337 338 =============== =========================================================== 339 Type of file Installation directory 340 =============== =========================================================== 341 modules :file:`{userbase}/lib/python{X.Y}/site-packages` 342 scripts :file:`{userbase}/bin` 343 data :file:`{userbase}` 344 C headers :file:`{userbase}/include/python{X.Y}/{distname}` 345 =============== =========================================================== 346 347 And here are the values used on Windows: 348 349 =============== =========================================================== 350 Type of file Installation directory 351 =============== =========================================================== 352 modules :file:`{userbase}\\Python{XY}\\site-packages` 353 scripts :file:`{userbase}\\Scripts` 354 data :file:`{userbase}` 355 C headers :file:`{userbase}\\Python{XY}\\Include\\{distname}` 356 =============== =========================================================== 357 358 The advantage of using this scheme compared to the other ones described below is 359 that the user site-packages directory is under normal conditions always included 360 in :data:`sys.path` (see :mod:`site` for more information), which means that 361 there is no additional step to perform after running the :file:`setup.py` script 362 to finalize the installation. 363 364 The :command:`build_ext` command also has a ``--user`` option to add 365 :file:`{userbase}/include` to the compiler search path for header files and 366 :file:`{userbase}/lib` to the compiler search path for libraries as well as to 367 the runtime search path for shared C libraries (rpath). 368 369 370 .. _inst-alt-install-home: 309 371 310 372 Alternate installation: the home scheme … … 315 377 "home" directory on Unix, since it's not unusual for a Unix user to make their 316 378 home directory have a layout similar to :file:`/usr/` or :file:`/usr/local/`. 317 This scheme can be used by anyone, regardless of the operating system the ir318 installing for.379 This scheme can be used by anyone, regardless of the operating system they 380 are installing for. 319 381 320 382 Installing a new module distribution is as simple as :: … … 328 390 python setup.py install --home=~ 329 391 392 To make Python find the distributions installed with this scheme, you may have 393 to :ref:`modify Python's search path <inst-search-path>` or edit 394 :mod:`sitecustomize` (see :mod:`site`) to call :func:`site.addsitedir` or edit 395 :data:`sys.path`. 396 330 397 The :option:`--home` option defines the installation base directory. Files are 331 398 installed to the following directories under the installation base as follows: 332 399 333 +------------------------------+---------------------------+-----------------------------+ 334 | Type of file | Installation Directory | Override option | 335 +==============================+===========================+=============================+ 336 | pure module distribution | :file:`{home}/lib/python` | :option:`--install-purelib` | 337 +------------------------------+---------------------------+-----------------------------+ 338 | non-pure module distribution | :file:`{home}/lib/python` | :option:`--install-platlib` | 339 +------------------------------+---------------------------+-----------------------------+ 340 | scripts | :file:`{home}/bin` | :option:`--install-scripts` | 341 +------------------------------+---------------------------+-----------------------------+ 342 | data | :file:`{home}/share` | :option:`--install-data` | 343 +------------------------------+---------------------------+-----------------------------+ 400 =============== =========================================================== 401 Type of file Installation directory 402 =============== =========================================================== 403 modules :file:`{home}/lib/python` 404 scripts :file:`{home}/bin` 405 data :file:`{home}` 406 C headers :file:`{home}/include/python/{distname}` 407 =============== =========================================================== 408 409 (Mentally replace slashes with backslashes if you're on Windows.) 344 410 345 411 .. versionchanged:: 2.4 … … 347 413 348 414 349 .. _inst-alt-install- home:415 .. _inst-alt-install-prefix-unix: 350 416 351 417 Alternate installation: Unix (the prefix scheme) … … 356 422 into the third-party module directory of a different Python installation (or 357 423 something that looks like a different Python installation). If this sounds a 358 trifle unusual, it is---that's why the "home scheme" comes first. However,424 trifle unusual, it is---that's why the user and home schemes come before. However, 359 425 there are at least two known cases where the prefix scheme will be useful. 360 426 … … 384 450 :option:`--prefix`. Files are installed as follows: 385 451 386 +------------------------------+-----------------------------------------------------+-----------------------------+ 387 | Type of file | Installation Directory | Override option | 388 +==============================+=====================================================+=============================+ 389 | pure module distribution | :file:`{prefix}/lib/python{X.Y}/site-packages` | :option:`--install-purelib` | 390 +------------------------------+-----------------------------------------------------+-----------------------------+ 391 | non-pure module distribution | :file:`{exec-prefix}/lib/python{X.Y}/site-packages` | :option:`--install-platlib` | 392 +------------------------------+-----------------------------------------------------+-----------------------------+ 393 | scripts | :file:`{prefix}/bin` | :option:`--install-scripts` | 394 +------------------------------+-----------------------------------------------------+-----------------------------+ 395 | data | :file:`{prefix}/share` | :option:`--install-data` | 396 +------------------------------+-----------------------------------------------------+-----------------------------+ 452 ================= ========================================================== 453 Type of file Installation directory 454 ================= ========================================================== 455 Python modules :file:`{prefix}/lib/python{X.Y}/site-packages` 456 extension modules :file:`{exec-prefix}/lib/python{X.Y}/site-packages` 457 scripts :file:`{prefix}/bin` 458 data :file:`{prefix}` 459 C headers :file:`{prefix}/include/python{X.Y}/{distname}` 460 ================= ========================================================== 397 461 398 462 There is no requirement that :option:`--prefix` or :option:`--exec-prefix` … … 419 483 420 484 421 .. _inst-alt-install- windows:485 .. _inst-alt-install-prefix-windows: 422 486 423 487 Alternate installation: Windows (the prefix scheme) … … 434 498 435 499 The installation base is defined by the :option:`--prefix` option; the 436 :option:`--exec-prefix` option is not supported under Windows. Files are 437 installed as follows: 438 439 +------------------------------+---------------------------+-----------------------------+ 440 | Type of file | Installation Directory | Override option | 441 +==============================+===========================+=============================+ 442 | pure module distribution | :file:`{prefix}` | :option:`--install-purelib` | 443 +------------------------------+---------------------------+-----------------------------+ 444 | non-pure module distribution | :file:`{prefix}` | :option:`--install-platlib` | 445 +------------------------------+---------------------------+-----------------------------+ 446 | scripts | :file:`{prefix}\\Scripts` | :option:`--install-scripts` | 447 +------------------------------+---------------------------+-----------------------------+ 448 | data | :file:`{prefix}\\Data` | :option:`--install-data` | 449 +------------------------------+---------------------------+-----------------------------+ 500 :option:`--exec-prefix` option is not supported under Windows, which means that 501 pure Python modules and extension modules are installed into the same location. 502 Files are installed as follows: 503 504 =============== ========================================================== 505 Type of file Installation directory 506 =============== ========================================================== 507 modules :file:`{prefix}\\Lib\\site-packages` 508 scripts :file:`{prefix}\\Scripts` 509 data :file:`{prefix}` 510 C headers :file:`{prefix}\\Include\\{distname}` 511 =============== ========================================================== 450 512 451 513 … … 461 523 case, you're creating a *custom installation scheme*. 462 524 463 You probably noticed the column of "override options" in the tables describing 464 the alternate installation schemes above. Those options are how you define a 465 custom installation scheme. These override options can be relative, absolute, 525 To create a custom installation scheme, you start with one of the alternate 526 schemes and override some of the installation directories used for the various 527 types of files, using these options: 528 529 ====================== ======================= 530 Type of file Override option 531 ====================== ======================= 532 Python modules ``--install-purelib`` 533 extension modules ``--install-platlib`` 534 all modules ``--install-lib`` 535 scripts ``--install-scripts`` 536 data ``--install-data`` 537 C headers ``--install-headers`` 538 ====================== ======================= 539 540 These override options can be relative, absolute, 466 541 or explicitly defined in terms of one of the installation base directories. 467 542 (There are two installation base directories, and they are normally the same--- 468 543 they only differ when you use the Unix "prefix scheme" and supply different 469 :option:`--prefix` and :option:`--exec-prefix` options.) 544 ``--prefix`` and ``--exec-prefix`` options; using ``--install-lib`` will 545 override values computed or given for ``--install-purelib`` and 546 ``--install-platlib``, and is recommended for schemes that don't make a 547 difference between Python and extension modules.) 470 548 471 549 For example, say you're installing a module distribution to your home directory … … 494 572 itself. This is almost as easy as customizing the script installation directory 495 573 ---you just have to remember that there are two types of modules to worry about, 496 pure modules and non-pure modules (i.e., modules from a non-pure distribution). 497 For example:: 498 499 python setup.py install --install-purelib=Site --install-platlib=Site 500 501 The specified installation directories are relative to :file:`{prefix}`. Of 502 course, you also have to ensure that these directories are in Python's module 503 search path, such as by putting a :file:`.pth` file in :file:`{prefix}`. See 504 section :ref:`inst-search-path` to find out how to modify Python's search path. 574 Python and extension modules, which can conveniently be both controlled by one 575 option:: 576 577 python setup.py install --install-lib=Site 578 579 The specified installation directory is relative to :file:`{prefix}`. Of 580 course, you also have to ensure that this directory is in Python's module 581 search path, such as by putting a :file:`.pth` file in a site directory (see 582 :mod:`site`). See section :ref:`inst-search-path` to find out how to modify 583 Python's search path. 505 584 506 585 If you want to define an entire installation scheme, you just have to supply all … … 554 633 python setup.py install --install-base=/tmp 555 634 556 would install pure modules to :file:` {/tmp/python/lib}` in the first case, and557 to :file:` {/tmp/lib}` in the second case. (For the second case, you probably635 would install pure modules to :file:`/tmp/python/lib` in the first case, and 636 to :file:`/tmp/lib` in the second case. (For the second case, you probably 558 637 want to supply an installation base of :file:`/tmp/python`.) 559 638 … … 572 651 573 652 574 .. XXX I'm not sure where this section should go.653 .. XXX Move this to Doc/using 575 654 576 655 .. _inst-search-path: … … 695 774 +--------------+-------------------------------------------------+-------+ 696 775 776 On all platforms, the "personal" file can be temporarily disabled by 777 passing the `--no-user-cfg` option. 778 697 779 Notes: 698 780 … … 930 1012 ^^^^^^^^^^^^^^^^^^^^^^ 931 1013 932 These instructions only apply if you're using a version of Python prior to933 2.4.1 with a MinGW prior to 3.0.0 (with binutils-2.13.90-20030111-1).934 935 1014 This section describes the necessary steps to use Distutils with the GNU C/C++ 936 1015 compilers in their Cygwin and MinGW distributions. [#]_ For a Python interpreter … … 938 1017 following steps. 939 1018 940 These compilers require some special libraries. This task is more complex than 1019 Not all extensions can be built with MinGW or Cygwin, but many can. Extensions 1020 most likely to not work are those that use C++ or depend on Microsoft Visual C 1021 extensions. 1022 1023 To let Distutils compile your extension with Cygwin you have to type:: 1024 1025 python setup.py build --compiler=cygwin 1026 1027 and for Cygwin in no-cygwin mode [#]_ or for MinGW type:: 1028 1029 python setup.py build --compiler=mingw32 1030 1031 If you want to use any of these options/compilers as default, you should 1032 consider writing it in your personal or system-wide configuration file for 1033 Distutils (see section :ref:`inst-config-files`.) 1034 1035 Older Versions of Python and MinGW 1036 """""""""""""""""""""""""""""""""" 1037 The following instructions only apply if you're using a version of Python 1038 inferior to 2.4.1 with a MinGW inferior to 3.0.0 (with 1039 binutils-2.13.90-20030111-1). 1040 1041 These compilers require some special libraries. This task is more complex than 941 1042 for Borland's C++, because there is no program to convert the library. First 942 1043 you have to create a list of symbols which the Python DLL exports. (You can find 943 1044 a good program for this task at 944 http:// www.emmestech.com/software/pexports-0.43/download_pexports.html).1045 http://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/). 945 1046 946 1047 .. I don't understand what the next line means. --amk … … 968 1069 normal libraries do. 969 1070 970 To let Distutils compile your extension with Cygwin you now have to type ::971 972 python setup.py build --compiler=cygwin973 974 and for Cygwin in no-cygwin mode [#]_ or for MinGW type::975 976 python setup.py build --compiler=mingw32977 978 If you want to use any of these options/compilers as default, you should979 consider to write it in your personal or system-wide configuration file for980 Distutils (see section :ref:`inst-config-files`.)981 982 1071 983 1072 .. seealso::
Note:
See TracChangeset
for help on using the changeset viewer.