How to install Python for .NET on Windows

The proper way to load CLR in Python is like this:

  1. 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.
  2. Append the directory with Python.NET files (clr.pyd and Python.Runtime.dll) to sys.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:

https://github.com/pythonnet/pythonnet/wiki/Installation

Leave a Comment