为什么我不能在 processing.py 中使用 numpy 库?
Why can't I use numpy library in processing.py?
我的问题是我无法将 numpy 导入到我的 processing.py 项目中。当我尝试导入它时,出现错误 "No module named numpy"。我能做什么?
处理是建立在 JVM 之上的,所以 the Python mode of Processing uses Jython rather than CPython. Unfortunately, numpy doesn't support Jython. Thus, you are trying to do something which is impossible. From the SciPy FAQ:
Q: Does NumpPy/SciPy work with Jython or C#/.Net?
A: No, neither are supported. Jython never worked, because it runs on
top of the Java Virtual Machine and has no way to interface with
extensions written in C for the standard Python (CPython)
interpreter."
This question discusses some alternatives to numpy which can be used from Jython. The official Jython FAQ recommends JNumeric.
我的问题是我无法将 numpy 导入到我的 processing.py 项目中。当我尝试导入它时,出现错误 "No module named numpy"。我能做什么?
处理是建立在 JVM 之上的,所以 the Python mode of Processing uses Jython rather than CPython. Unfortunately, numpy doesn't support Jython. Thus, you are trying to do something which is impossible. From the SciPy FAQ:
Q: Does NumpPy/SciPy work with Jython or C#/.Net?
A: No, neither are supported. Jython never worked, because it runs on top of the Java Virtual Machine and has no way to interface with extensions written in C for the standard Python (CPython) interpreter."
This question discusses some alternatives to numpy which can be used from Jython. The official Jython FAQ recommends JNumeric.