When packaging for macOS, cx_freeze may work for you. However, there is another alternative named py2app, which we will take a look at now.
Ensure you have the tkedit.py file described in the Windows section earlier, then install py2app into our virtual environment using pip. We will need version 0.13, since later versions do not support Tkinter properly:
$ source env/bin/activate$ pip install py2app==0.13
With py2app installed, you can go ahead and let it generate a setup.py file using its setup tools:
$ py2applet --make-setup tkedit.py
This should overwrite your setup.py file with a new one. We will need to add our PyYAML dependency to it, so it looks like so:
"""This is a setup.py script generated by py2appletUsage: python setup.py ...