I have a python script which will be executed by the system python (on OSX /usr/bin/python). This script uses an external package (in my case PyYaml).
How can I provide the package without pip-installing it into the system python. I do not want to create a virtual environment for this script either, because the script is meant to run on other "vanilla" OSX machines as well.
I'm thinking of creating a directory under the same path where the script resides and "dumping" the external package there. But in what form? And what do I have to do in my script, so that it "sees" the locally dumped package? Just amend sys.path?
$PYTHONPATHenvironment variable (OS dependent). On Mac/Linux I just setexport PYTHONPATH=$PYTHONPATH:<path_to_python_packages_directory>, re-load the environment. Then "import the_package" in python. Unfortunately, for some packages that depend on CPython, or "C" source files that go to the OS level, it's not possible, or rarely works, but does for most python packages.pyYamland it seems like it worked (I could import it), but there are some "C" source files in that package, so it may not work as expected.py-files, because PyYaml contains according to the doco "both pure-Python and fast LibYAML-based parsers and emitters" (pyyaml.org/wiki/PyYAML). So aslong as I do not importCLoaderandCDumperfromyamlI should be fine.