Problem
I use pyenv
. I have a virtual environment activated in my working directory (with Python version 3.10.0
).
Following the tutorial here, after doing the command
python setup.py py2app -A
and trying to run my application for the first time (from the folder dist
), this error occurs:
A Python runtime not could be located. You may need to install a framework build of Python, or edit the PyRuntimeLocations array in this application's Info.plist file.
--
Note
The file dist/myapp.app/Contents/Info.plist
has the following lines:
<key>PyRuntimeLocations</key>
<array>
<string>@executable_path/../Frameworks/libpython3.10.dylib</string>
<string>/Users/Vladimir/.pyenv/versions/3.10.0/lib/libpython3.10.dylib</string>
However, this file /Users/Vladimir/.pyenv/versions/3.10.0/lib/libpython3.10.dylib
does not even exist:
here is the result of ls /Users/Vladimir/.pyenv/versions/3.10.0/lib/
:
libpython3.10.a pkgconfig python3.10
Attempted solution
After seeing this answer, I tried to install Python from python.org, then
pip3 install py2app
, ... and other packages for my app,
and then did the same procedure from the tutorial, but this time with python3
.
It worked.
Question
Is there a way to make py2app
work with pyenv
?
It's not convenient to have a separate Python installation from python.org where you would have to re-download all your packages for your project, and also give up the possibility of having different environments for different Python projects.