



In code, you can also call the eVersion function, which is equivalent to setting PYTHON_VERSION. Note that PYTHON_LIBRARY takes precedence over PYTHON_VERSION. The exact filename will differ across Python environments and platforms.Īlternatively, you can set the PYTHON_VERSION environment variable, which instructs Swift to search system library paths for a matching Python version. For example:Įxport PYTHON_LIBRARY="~/anaconda3/lib/libpython3.7m.so" To use a specific Python installation, set the PYTHON_LIBRARY environment variable to the libpython shared library provided by the installation. import PythonKitīy default, when you import Python, Swift searches system library paths for the newest version of Python installed. You can import Python modules from Swift, call Python functions, and convert values between Swift and Python. Swift For TensorFlow supports Python interoperability.
