I downloaded Python for .NET.
Inside the zip is clr.pyd
, nPython.exe
, Python.Runtime.dll
and 2 debug database files.
I put the clr.pyd and Python.Runtime.dll in my python DLLs dir C:\Python27\DLLs thinking this is all that's needed for installation. I then open up the Python GUI and type import clr and I get:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import clr
SystemError: dynamic module not initialized properly
New to python but not .NET and want to use the CPython and not IronPython. What am I missing in this installation? The readme of Python for .NET says there is an installation for Windows package but all I found was the zip file.
The proper way to load CLR in Python is like this:
clr.pyd
in one of folders. Note that pip for some old versions did not remove all parts of Python.NET.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:
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