Skip to content

Instantly share code, notes, and snippets.

@meshula
Created April 24, 2020 16:56
Show Gist options
  • Select an option

  • Save meshula/a056f5aaf4d7855c24a9fa5df3c8ada1 to your computer and use it in GitHub Desktop.

Select an option

Save meshula/a056f5aaf4d7855c24a9fa5df3c8ada1 to your computer and use it in GitHub Desktop.
embedding python

Objective C

reference [https://stackoverflow.com/questions/26660287/how-to-embed-python-in-an-objective-c-os-x-application-for-plugins] https://stackoverflow.com/questions/26660287/how-to-embed-python-in-an-objective-c-os-x-application-for-plugins

download the source tarball desired from Python.org

Create a build directory with no spaces, because #! don't work with space, /Users/me/Projects/PythonHost

extract the python tarball resulting in e.g. /Users/me/Projects/PythonHost/Python-3.7.7

download openssl-1.1.1g.tar.gz from openssl.org, similarly, extract to /Users/me/Projects/PythonHost/openssl-1.1.g

cd into that directory and:

./config
make
sudo make install

cd into the Python-3.7.7 directory, and

./configure --prefix=/Users/me/Projects/PythonHost/python-3.7.7-dev
make -j4
make install

lzma and tkinter, as well as ssl fail to build. Not a problem, probably.

make sure the python environment is viable by setting the PYTHONPATH

export PYTHONPATH="/Users/me/Projects/PythonHost/python-3.7.7-dev/lib/python3.7/site-packages/"

AND pip doesn't work because the ssl module failed to build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment