How to make py2app and cxfreeze use Python 3 as default version

2.4k views Asked by At

I'm trying to convert a script called "applicationtest.py" into a standalone osx app. I have tried to do so with py2app: https://pythonhosted.org/py2app/tutorial.html, and with cxfreeze: http://cx-freeze.readthedocs.io/en/latest/script.html#script. Both modules create a folder that has your new application + the required supporting packages/scripts/lib in it.

However, when I look in these folders, I notice that the library is set for python 2.7, while the script that I want to turn into an application is written in 3.6.

Example:

:dist username$ tree

gives:

.
└── applicationtest.app
    └── Contents
        ├── Info.plist
        ├── MacOS
        │   ├── applicationtest
        │   └── python -> /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/bin/python
        ├── PkgInfo
        └── Resources
            ├── PythonApplet.icns -> /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/Resources/PythonApplet.icns
            ├── __boot__.py
            ├── __error__.sh
            ├── lib
            │   └── python2.7
            │       ├── config -> /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config
            │       └── site.pyc -> ../../site.pyc
            ├── site.py
            └── site.pyc

7 directories, 10 files

Q: How do I set python 3 to be used when creating applications?

Thanks in advance!

1

There are 1 answers

0
titusAdam On BEST ANSWER

Found out what I was doing wrong. I needed to run:

python3.6 setup.py py2app -A

instead of:

python setup.py py2app -A

Sorry!