| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -661,6 +661,17 @@ This is how :data:`sys.path` is populated on Windows: | |||
| 661 | 661 | the environment, and no registry entries can be found, a default path with | |
| 662 | 662 | relative entries is used (e.g. ``.\Lib;.\plat-win``, etc). | |
| 663 | 663 | ||
| 664 | + If a ``pyvenv.cfg`` file is found alongside the main executable or in the | ||
| 665 | + directory one level above the executable, the following variations apply: | ||
| 666 | + | ||
| 667 | + * If ``home`` is an absolute path and :envvar:`PYTHONHOME` is not set, this | ||
| 668 | + path is used instead of the path to the main executable when deducing the | ||
| 669 | + home location. | ||
| 670 | + | ||
| 671 | + * If ``applocal`` is set to true, the ``home`` property or the main executable | ||
| 672 | + is always used as the home path, and all environment variables or registry | ||
| 673 | + values affecting the path are ignored. The landmark file is not checked. | ||
| 674 | + | ||
| 664 | 675 | The end result of all this is: | |
| 665 | 676 | ||
| 666 | 677 | * When running :file:`python.exe`, or any other .exe in the main Python | |
@@ -672,13 +683,17 @@ The end result of all this is: | |||
| 672 | 683 | etc), the "Python Home" will not be deduced, so the core path from the | |
| 673 | 684 | registry is used. Other "application paths" in the registry are always read. | |
| 674 | 685 | ||
| 675 | - * If Python can't find its home and there is no registry (eg, frozen .exe, some | ||
| 676 | - very strange installation setup) you get a path with some default, but | ||
| 686 | + * If Python can't find its home and there are no registry value (frozen .exe, | ||
| 687 | + some very strange installation setup) you get a path with some default, but | ||
| 677 | 688 | relative, paths. | |
| 678 | 689 | ||
| 679 | 690 | For those who want to bundle Python into their application or distribution, the | |
| 680 | 691 | following advice will prevent conflicts with other installations: | |
| 681 | 692 | ||
| 693 | + * Include a ``pyvenv.cfg`` file alongside your executable containing | ||
| 694 | + ``applocal = true``. This will ensure that your own directory will be used to | ||
| 695 | + resolve paths even if you have included the standard library in a ZIP file. | ||
| 696 | + | ||
| 682 | 697 | * If you are loading :file:`python3.dll` or :file:`python35.dll` in your own | |
| 683 | 698 | executable, explicitly call :c:func:`Py_SetPath` or (at least) | |
| 684 | 699 | :c:func:`Py_SetProgramName` before :c:func:`Py_Initialize`. | |
@@ -688,7 +703,7 @@ following advice will prevent conflicts with other installations: | |||
| 688 | 703 | ||
| 689 | 704 | * If you cannot use the previous suggestions (for example, you are a | |
| 690 | 705 | distribution that allows people to run :file:`python.exe` directly), ensure | |
| 691 | - that the landmark file (:file:`Lib\\os.py`) exists in your bundled library. | ||
| 706 | + that the landmark file (:file:`Lib\\os.py`) exists in your install directory. | ||
| 692 | 707 | (Note that it will not be detected inside a ZIP file.) | |
| 693 | 708 | ||
| 694 | 709 | These will ensure that the files in a system-wide installation will not take | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,6 +10,9 @@ Release date: 2015-05-24 | |||
| 10 | 10 | Core and Builtins | |
| 11 | 11 | ----------------- | |
| 12 | 12 | ||
| 13 | + - Issue #23955: Add pyvenv.cfg option to suppress registry/environment | ||
| 14 | + lookup for generating sys.path on Windows. | ||
| 15 | + | ||
| 13 | 16 | - Issue #24257: Fixed system error in the comparison of faked | |
| 14 | 17 | types.SimpleNamespace. | |
| 15 | 18 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments