如何安装Python的.NET Windows上 [英] How to install Python for .NET on Windows

查看:1430
本文介绍了如何安装Python的.NET Windows上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载的Python .NET
里面的拉链是 clr.pyd nPython.exe Python.Runtime.dll 2调试数据库文件。
我把clr.pyd和Python.Runtime.dll在我的Python的DLL目录C:\ Python27 \ DLL的思考,这是所有需要进行安装。然后我打开了Python GUI和类型的进口CLR和我得到的:

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

新的Python但不是.NET和要使用的CPython的,而不是IronPython的。那我在此安装丢失? 的Python for .NET的的自述说,有一个Windows安装包,但所有我发现是zip文件。

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.

推荐答案

正确的方式来加载CLR在Python是这样的:

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

  1. 确保没有旧的东西是从PythonNET留在Python的安装文件夹(如C:\ Python27)。在我来说,我有传统的clr.pyd在文件夹中的一个。需要注意的是画中画的一些老版本没有删除PythonNET的所有部分。
  2. 在附加与PythonNET文件(clr.pyd,Python.Runtime.dll,..)的目录到sys.path中

现在您可以加载CLR最灵活的方式,甚至没有安装Python的目录!

Now you can load CLR the most flexible way without even installing to Python directories!

您可以从源代码编译在GitHub上:

You can compile from source on github:

https://github.com/pythonnet/pythonnet/tree/develop

或使用Windows轮/从克里斯托夫Gohlke安装:

or use Windows wheels/installers from Christoph Gohlke:

http://www.lfd.uci.edu/~gohlke/pythonlibs/

包的PyPI可以从PIP安装:

PyPI package is available for installation from pip:

https://pypi.python.org/pypi/pythonnet

这篇关于如何安装Python的.NET Windows上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆