为IronPython安装numpy [英] Install numpy for IronPython
问题描述
我想使用c#在IronPython中运行一些代码.在此代码中,我需要使用numpy.因此,我尝试使用以下命令进行安装:
I wanted to run some code in IronPython using c#. In this code I needed to use numpy. So I tried to install it using the command below:
ipy -X:Frames -m pip install -U numpy
不幸的是,我收到一个错误,并返回一条消息,告诉我它安装失败.错误消息如下:
Unfortunately, I get an error and a return message telling me it was a unsuccessful installation. The error message is bellow:
Using cached https://files.pythonhosted.org/packages/3a/20/c81632328b1a4e1db65f45c0a1350a9c5341fd4bbb8ea66cdd98da56fe2e/numpy-1.15.0.zip
Installing collected packages: numpy
Running setup.py install for numpy ... error
Complete output from command "C:\Program Files\IronPython 2.7\ipy.exe" -u -c "import setuptools, tokenize;__file__='c:\\users\\mbhamida\\appdata\\local\\temp\\pip-build-t61kxu\\numpy\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\mbhamida\appdata\local\temp\pip-y91bz0-record\install-record.txt --single-version-externally-managed --compile:
Running from numpy source directory.
Note: if you need reliable uninstall behavior, then install
with pip instead of using `setup.py install`:
- `pip install .` (from a git repo or downloaded source
release)
- `pip install numpy` (last NumPy release on PyPi)
C:\Program Files\IronPython 2.7\Lib\distutils\dist.py:1: UserWarning: Unknown distribution option: 'python_requires'
"""distutils.dist
blas_opt_info:
blas_mkl_info:
customize MSVCCompiler
libraries mkl_rt not found in ['C:\\Program Files\\IronPython 2.7\\lib']
NOT AVAILABLE
blis_info:
customize MSVCCompiler
libraries blis not found in ['C:\\Program Files\\IronPython 2.7\\lib']
NOT AVAILABLE
openblas_info:
customize MSVCCompiler
customize MSVCCompiler
libraries openblas not found in ['C:\\Program Files\\IronPython 2.7\\lib']
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\setup.py", line 410, in <module>
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\core.py", line 135, in setup
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\system_info.py", line 625, in get_info
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\system_info.py", line 433, in get_info
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\system_info.py", line 625, in get_info
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\system_info.py", line 1758, in calc_info
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\fcompiler\__init__.py", line 61, in <module>
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\setup.py", line 402, in setup_package
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\setup.py", line 167, in configuration
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\misc_util.py", line 1032, in add_subpackage
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\misc_util.py", line 998, in get_subpackage
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\misc_util.py", line 940, in _get_configuration_from_setup_py
File "numpy\setup.py", line 10, in configuration
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\misc_util.py", line 1032, in add_subpackage
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\misc_util.py", line 998, in get_subpackage
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\misc_util.py", line 940, in _get_configuration_from_setup_py
File "numpy\core\setup.py", line 832, in configuration
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\system_info.py", line 433, in get_info
File "c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\numpy\distutils\system_info.py", line 1621, in calc_info
TypeError: a new-style class can't have only classic bases
----------------------------------------
Command ""C:\Program Files\IronPython 2.7\ipy.exe" -u -c "import setuptools, tokenize;__file__='c:\\users\\mbhamida\\appdata\\local\\temp\\pip-build-t61kxu\\numpy\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\mbhamida\appdata\local\temp\pip-y91bz0-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\mbhamida\appdata\local\temp\pip-build-t61kxu\numpy\
我搜索了很多有关解决方案的信息,但我想这是一个非常普遍的问题. 附:我在其他许多软件包中也遇到了同样的问题.
I searched a lot about a solution, but I guess it is a very common problem. Ps: I face the same problem with many other packages.
有什么解决方案?
推荐答案
Python首先是一种语言,并且在C:CPython中具有默认实现. IronPython是基于.NET的另一种语言实现.因此,它实现了默认的核心语言和大多数标准库.
Python is first and foremost a language and has a default implementation in C: CPython. IronPython is another implementation of the language, based on .NET. As such, it implements the default core language and most of the standard library.
某些可通过PIP获得的Python软件包是纯Python,并且依赖于IronPython支持的元素.但是,某些其他模块特定于实现.特别地,numpy使用本机C代码,CPython支持此代码,但IronPython不支持.关于IronPython问题跟踪器的更多信息: https://github.com/IronLanguages/ironpython2/issues/
Some Python packages available through PIP are pure Python and rely on elements supported by IronPython. Some other modules are, however, specific to the implementation. In particular, numpy uses native C code, which is supported by CPython but not by IronPython. More info on the IronPython issue tracker: https://github.com/IronLanguages/ironpython2/issues/
要使其工作,numpy必须提供与.NET的兼容性.我已经看到了numpy的.NET重构,但从未成功.
For it to work, numpy would have to offer compatibility with .NET. I have seen a .NET refactor of numpy, but never got it working.
您的问题的解决方案?避免将numpy和.NET混合使用.不过,如果您找到一种使它起作用的方法,我会很感兴趣.
A solution for your problem? Avoid mixing numpy and .NET. If you find a way to make it work, though, I'm interested.
您可能想看一下有关如何安装numpy的答案: https://stackoverflow.com /a/51900761/6690989
You might want to have a look at this answer on how to install numpy: https://stackoverflow.com/a/51900761/6690989
这篇关于为IronPython安装numpy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!