如何在jython中设置numpy [英] How to setup numpy in jython

查看:1072
本文介绍了如何在jython中设置numpy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个名为JyNI的项目,可让您在Jython中运行NumPy.但是,关于如何使NumPy进入Jython,我尚未见过.我已经尝试过'pip install numpy'(适用于普通的python 3.4.3),但是给出了关于缺少py3k模块的错误.有人对此有更多信息吗?

There is a project called JyNI that allows you to run NumPy in Jython. However I haven't come across anywhere on how to get NumPy into Jython. I've tried 'pip install numpy' (which will work for normal python 3.4.3) but gives an error about a missing py3k module. Does anybody have a bit more information about this?

推荐答案

JyNI确实将NumPy支持作为主要目标,但只要它仍处于Alpha状态,它就不能做到. 但是,直到成熟为止,您可以通过以下方式使用NumPy:

JyNI does state NumPy-support as its main goal, but cannot do it yet, as long as it is still in alpha-state. However until it is mature enough you can use NumPy via

  • JEP (https://github.com/mrj0/jep) or
  • JPY (https://github.com/bcdev/jpy).

或者,您可以使用Java数字库进行计算,例如其中之一:

Alternatively you can use a Java numerical library for your computation, e.g. one of these:

  • https://github.com/mikiobraun/jblas
  • https://github.com/fommil/matrix-toolkits-java

都是Java库,它们在blas或lapack的支持下进行数值处理(即NumPy使用的后端相同),因此性能应该或多或少等于NumPy.但是,它们不像NumPy那样具有出色的多数组实现功能.

Both are Java-libs that do numerical processing natively backed by blas or lapack (i.e. the same backends NumPy uses), so the performance should equal that of NumPy more or less. However they don't feature such a nice multiarray implementation as NumPy does afaik.

如果您间接需要NumPy来实现对其他框架的依赖,则这些解决方案将无法立即使用.如果依赖性很小,那么您可以根据指定的项目之一重写/替换相应的调用.否则,您将不得不等待JyNI ...

If you need NumPy indirectly to fulfill dependencies of some other framework, these solutions won't do it out of the box. If the dependencies are only marginal you can maybe rewrite/substitute the corresponding calls based on one of the named projects. Otherwise you'll have to wait for JyNI...

如果您可以通过这种方式在Jython上运行某些框架,请考虑将您的工作公开发布,最好是作为框架的分支.

If you can make some framework running on Jython this way, please consider to make your work publicly available, ideally as a fork of the framework.

这篇关于如何在jython中设置numpy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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