简体   繁体   English

为pypy2.2.1安装numpy时出现错误

[英]error when installing numpy for pypy2.2.1

I am trying to use pypy. 我正在尝试使用pypy。 My python scripts are using numpy. 我的python脚本正在使用numpy。 So when I used pypy 1.9.0 it showed me this: 因此,当我使用pypy 1.9.0时,它向我显示了这一点:

"The 'numpy' module of PyPy is in-development and not complete. "
ImportError: The '`numpy' module` of PyPy is in-development and not complete. To try it out anyway, you can either import from 'numpypy', or just write 'import numpypy' first in your program and then import from 'numpy' as usual.

So I used import numpypy and then ran my script. 所以我使用import numpypy,然后运行我的脚本。 I got this error: 我收到此错误:

File "customecode.py", line 97, in dist_new
    dlat = radians(p2[..., 0] - p1[..., 0])
TypeError: expected integer, got Ellipsis object

I couldn't find anything on this kind of error. 对于这种错误,我找不到任何东西。 Although script is running fine when I use python. 虽然当我使用python时脚本运行良好。 So my guess is that may be pypy still don't support everything which is there on numpy. 所以我的猜测是pypy仍然不支持numpy上的所有功能。

I found this link on pypy-numpy update. 我在pypy-numpy更新中找到了此链接。 So I install pypy 2.2.1 http://morepypy.blogspot.in/2013/11/numpy-status-update.html In this link following instructions are given for installing numpy for pypy: 所以我安装了pypy 2.2.1 http://morepypy.blogspot.in/2013/11/numpy-status-update.html在此链接中,给出了以下说明,用于为pypy安装numpy:

git clone https://bitbucket.org/pypy/numpy.git
cd numpy
pypy setup.py install

after running pypy setup.py install I got this type error: 运行pypy setup.py install ,出现此类型错误:

Traceback (most recent call last):
  File "app_main.py", line 51, in run_toplevel
  File "setup.py", line 239, in <module>
    setup_package()
  File "setup.py", line 231, in setup_package
    setup(**metadata)
  File "/home/administrator/numpy/numpy/distutils/core.py", line 169, in setup
    return old_setup(**new_attr)
  File "/usr/lib/pypy/lib-python/2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/pypy/lib-python/2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/pypy/lib-python/2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/administrator/numpy/numpy/distutils/command/install.py", line 57, in run
    r = old_install.run(self)
  File "/usr/lib/pypy/lib-python/2.7/distutils/command/install.py", line 613, in run
    self.run_command('build')
  File "/usr/lib/pypy/lib-python/2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/pypy/lib-python/2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/administrator/numpy/numpy/distutils/command/build.py", line 39, in run
    old_build.run(self)
  File "/usr/lib/pypy/lib-python/2.7/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/usr/lib/pypy/lib-python/2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/pypy/lib-python/2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/administrator/numpy/numpy/distutils/command/build_src.py", line 153, in run
    self.build_sources()
  File "/home/administrator/numpy/numpy/distutils/command/build_src.py", line 164, in build_sources
    self.build_library_sources(*libname_info)
  File "/home/administrator/numpy/numpy/distutils/command/build_src.py", line 299, in build_library_sources
    sources = self.generate_sources(sources, (lib_name, build_info))
  File "/home/administrator/numpy/numpy/distutils/command/build_src.py", line 386, in generate_sources
    source = func(extension, build_dir)
  File "numpy/core/setup.py", line 678, in get_mathlib_info
    st = config_cmd.try_link('int main(void) { return 0;}')
  File "/usr/lib/pypy/lib-python/2.7/distutils/command/config.py", line 248, in try_link
    self._check_compiler()
  File "/home/administrator/numpy/numpy/distutils/command/config.py", line 46, in _check_compiler
    old_config._check_compiler(self)
  File "/usr/lib/pypy/lib-python/2.7/distutils/command/config.py", line 103, in _check_compiler
    customize_compiler(self.compiler)
  File "/usr/lib/pypy/lib-python/2.7/distutils/ccompiler.py", line 44, in customize_compiler
    cpp = cc + " -E"           # not always
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

I want to use pypy 2.2.1 with whatever development of numpy provided there. 我想将pypy 2.2.1与那里提供的numpy开发一起使用。 Any help with the installation of numpy for pypy is appreciated. 感谢为pypy安装numpy的任何帮助。

In PyPy 2.2.1, the file lib-python/2.7/distutils/ccompiler.py does not contain any function called customize_compiler() and line 44 is not like that. 在PyPy 2.2.1中,文件lib-python / 2.7 / distutils / ccompiler.py不包含任何称为custom_compiler()的函数,并且第44行不是这样。 My guess is that your version of PyPy's standard library has been tweaked by your Linux distribution in a way that makes it crash in your particular case. 我的猜测是您的PyPy标准库版本已由Linux发行版进行了调整,从而使其在特定情况下崩溃。

I can only suggest that you try to get the "official" PyPy 2.2.1 and compare the results. 我只能建议您尝试获取“官方” PyPy 2.2.1并比较结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM