If you put the .spec file in its default location, you can simply remove pathex from the specification because the 'current directory' and 'your-configured-pathex-here' identical.
explanation
pathex is an optional list of paths to search for sys.path
Source: https://github.com/pyinstaller/pyinstaller/blob/develop/PyInstaller/building/build_main.py#L123
The specification file is actually executable Python code. PyInstaller creates the application by executing the contents of the specification file.
Source: https://github.com/pyinstaller/pyinstaller/blob/develop/doc/spec-files.rst#using-spec-files
This leads to the conclusion that you should be able to hard-code each path for three environments, for example
pathex=["/Users/fatuhoku/Python/myapp", "C:\\Python\\myapp", "/home/fatuhoku/Python/myapp"],
or call a manual Python function that simply returns a list with a single element, which is the current working directory.
If you run PyInstaller, it will tell you something like this:
46 INFO: Extending PYTHONPATH with paths ['current directory', 'your-configured-pathex-here']
source share