Starting from version 2019.1 MapInfo Pro x64 and MapInfo Runtime x64 Python 3.7.6 x64 will be installed with product in installation directory under Python37 folder.
Pro uses the PythonNet implementation to interact with the Python environment and allow interop between .net and python.
Python installation bundled within the product will have the below modules pre-loaded.
Python and the modules are installed in a subfolder under the Pro installation folder named PYTHON37
EFAL is installed in a subfolder under the Pro installation folder named EFAL
To install additional python modules user need to open the script prompt.bat in %INSTALLDIR%\Python37 folder and then execute the below command.
python -m pip install <module_name>
During the initialization of Python within MapInfo Pro, below environment variables are defined in the executing MapInfo Pro process for correctly loading shipped python37.
PROHOME → Path to current executing MapInfo Pro executable.
PROPYTHONHOME → Path to %INSTALLDIR%\Python37 folder shipped with MapInfo Pro installation.
PATH → Below paths added to PATH environment variable.
The "run application" MapBasic statement now supports running *.py files. Any valid python will work as long as the required modules are installed.
The Run Program dialog (Ctrl+U) now list both .mbx and .py files.
In addition you can drag a .py file onto Pro to run it.
If a startup.py file is found in one of the following locations it is executed in the global scope setup. Similar to the way startup.wor is found.
FOLDER_MI_APPDATA (-1)FOLDER_MI_LOCAL_APPDATA (-2)FOLDER_MI_PREFERENCE (-3)FOLDER_MI_COMMON_APPDATA (-4)
See GetFolderPath$() MapBasic function for more help on these locations.
Once the global scope has been initialized as above, each time python code is run a copy of the global scope is made and used to execute the code.