Search code examples
pythonpython-3.xmacospy2app

How can I fix the error which occurs while building app via py2app?


When I tried to build for deployment I get an error.

I typed the following command:

python3 setup.py py2app

Which results in the following error (this is the last two lines of output):

copying file /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python3 -> /Users/evrim/Desktop/code/WantedOutfits/dist/check_products.app/Contents/MacOS/python error: [Errno 2] /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python3: 'No such file or directory'

How can I fix this error?

Thank you in advance.


Solution

  • py2app is at this time not entirely compatible with the copy of Python 3.7 shipped as part of Xcode.

    A quick workaround is to create the missing file by copying the file named "Python" in the same directory, that is:

    cp /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python3
    

    There is an issue for this in the GitHub tracker for py2app, and I will fix this in a future release.