I'm trying to turn a python script into a OS X App that you can run directly from Finder. I'm trying out Platypus, which seemed like the simplest option. The problem I'm running into is with the packages I'm including in the script. I installed them through pip into a virtualenv. Wondering what the best/most proper way to include those files in the Platypus bundle would be. I know I could just copy them over to the same directory and include them in the Platypus bundle, but would prefer to do something cleaner like including the virtualenv, although it seems like that would then have to be installed by the users of the app.

I also ran into py2app which seems to be able to achieve something similar to Platypus, but their documentation is somewhat obscure.

2 Answers 2


The way I've solved this is in the past is by bundling the contents of the virtualenv directory into Platypus and then activating the bundled Python interpreter with a script.

Here's a screencap of the Platypus interface to show you what I mean:

Platypus window setup

You'll notice that I've bundled the entire venv directory (which was created with the virtualenv command), and my Python script, my_app.py.

The script that I'm actually telling Platypus to run, run.sh, is a shell script with the following contents:


"$PWD/venv/bin/python" my_app.py "$@"

All this script does is use the python binary in the venv directory to run the bundled Python script. The "$@" is there to pass any arguments to run.sh directly into my_app.py without changing them.

  • This doesn't really work, because Python keeps searching for its DLLs in system directories. Dec 4, 2020 at 10:40

Might be a better run.sh --->


# Save the current directory

# Change to the virtual environment directory (adjust the path as necessary)
cd venv

# Activate the virtual environment
source bin/activate

# Change back to the original directory

# Run the Python script
python3 app.py

# Optionally, deactivate the virtual environment
# deactivate

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .