Loading numpy into IronPython

我怕爱的太早我们不能终老 提交于 2020-01-23 12:22:13

问题


I've recently installed Ironpython + tools and having trouble loading external modules (numpy).

this is my test code:

import numpy
numpy.test()

when writing my simple test, intellisense can find numpy, however when it's run from vs2010, I get:

ImportException was unhandled by user code:
No module named numpy

IronPython Console output (shortened):

numpy\__init__.py line 141
numpy\add_newdocs.py line 9
numpy\lib\__init__.py line 4
numpy\lib\type_check.py line 8
numpy\core\__init__.py line 5
ImportError: No module named multiarray

the file multiarray.pyd is present in numpy\core.

I have numpy installed in my python 2.6 folder, (working). In an attempt to use it within ironpython, Following the instructions of numerous sources:

I've added "C:\Python26\Lib\" as a Search path to the project.

I've copied the site-packages, libs, include and DLLs folders from C:\Python26\ to C:\Program Files (x86)\IronPython 2.6 for .NET 4.0\

and I've added:

sys.path.append(r"C:\Python26\Lib")

to the IronPython site.py file.

I've also tried this with both x86 and AMD64 installs, including a complete reinstall of both python versions and ironpython.

Having run completely out of ideas (and the somewhat lackluster google results), I was hoping that someone here may have some suggestions.

Thanks Rabit


回答1:


I have used the Numpy implementation for IronPython from Enthough. It works so far, but I have not tested it enough.

I have blogged about it here

Numpy for .NET is implemented though wrappers to native calls.

In my blog post I used this tutorial.




回答2:


I don't believe Numpy is supported for IronPython: http://en.wikipedia.org/wiki/IronPython

Unless it's changed since that update. :(

Update: Apparently there are projects underway to get support for some of the CPython stuff which in turn would help support Numpy http://www.resolversystems.com/news/?p=17

Update 2: Apparently you can use numpy with some other open source product: http://ironpython-urls.blogspot.com/2008/08/ironclad-05-released-use-numpy-from.html

Update 3: Official link to Ironclad => http://code.google.com/p/ironclad/

Sorry, I'm not sure if this is of much help :(




回答3:


update 3: wrong twice, ip tools and ip are frustratingly bundled together... which vs2010 doesn't like. Getting closer though.. Currently working with 2.6 for .net4 in ipy console

http://code.google.com/p/ironclad/issues/detail?id=28

^^ explains that frames support is required for ironclad (something not mentioned too clearly)

also that this is potentially not fixed within the new 2.6 for .net 4, going to play with "frames" settings and/or try an older still version of ip



来源:https://stackoverflow.com/questions/3613409/loading-numpy-into-ironpython

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!