The proper way to load CLR in Python is like this:
- Make sure no old stuff is left from Python.NET in Python installation folder (e.g. C:\Python27). In my case I had legacy
clr.pyd
in one of folders. Note that pip for some old versions did not remove all parts of Python.NET. - Append the directory with Python.NET files (
clr.pyd
andPython.Runtime.dll
) tosys.path
Now you can load CLR the most flexible way without even installing to Python directories!
You can compile from source on github:
pip install git+https://github.com/pythonnet/pythonnet
or use Windows wheels/installers from Christoph Gohlke:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pythonnet
PyPI package is available for installation from pip:
https://pypi.python.org/pypi/pythonnet
More installation options such docker, WinPython, conda, nuget, choco are listed here: