Skip to content

Commit 182d528

Browse files
Update Configuration01.md
Added documentation about new macros relating to default Python installation folders.
1 parent 9caadd3 commit 182d528

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/tutorials/Configuration01.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,17 @@ Inside this last folder there is a file called `xlpython.cfg` which determines h
1313
To specify that the Python distribution in `%SOMEFOLDER%\MatrixAlgebra\PortablePython` must be used, make the following modification to `xlpython.cfg`
1414

1515
Command = $(WorkbookDir)\PortablePython\pythonw.exe -u "$(ConfigDir)\xlpyserver.py" $(CLSID)
16+
17+
## Using the default Python installation
18+
19+
Macros are available providing the folder of each Python version installed and registered as the default installation for that version, as stored in the Windows registry.
20+
21+
These take the form `$(Registry:PythonXYFolder)` where `X` is the major version and `Y` is the minor version (for example for Python 2.6 `$(Registry:Python26Folder)`). The installation path is read from `HKCU\Software\Python\PythonCore\X.Y\InstallPath`.
22+
23+
Minor version agnostic macros are also available: `$(Registry:Python2Folder)` and `$(Registry:Python3Folder)`. They are equal to the folder of the installation with the greatest minor version. For example if Python 2.6 and Python 2.7 are both installed and registered, `$(Registry:Python2Folder)` is equal to the installation folder of the default Python 2.7.
24+
25+
The obvious use case for these macros is the `Command` setting in `xlpython.cfg`. For example, to instruct ExcelPython to use Python 2 even if Python 3 takes precedence according to the system path, one can modify the `Command` setting as follows:
26+
27+
# The command line used to launch the COM server
28+
Command = "$(Registry:Python2Folder)\pythonw.exe" -u "$(ConfigDir)\xlpyserver.py" $(CLSID)
29+

0 commit comments

Comments
 (0)