Loading numpy into IronPython
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 t开发者_开发知识库ried 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
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.
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 :(
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
精彩评论