简体   繁体   English

在python3中导入sdl2时出错

[英]Error importing sdl2 in python3

I have a file test.py which contains only the line "import sdl2". 我有一个文件test.py,其中仅包含“ import sdl2”行。 I am running Ubuntu and have installed libsdl2 from the official repos and installed pysdl2 from pip3. 我正在运行Ubuntu,并已从官方仓库中安装了libsdl2,并已从pip3中安装了pysdl2。 I get this error: 我收到此错误:

Traceback (most recent call last):
  File "./test.py", line 2, in <module>
    import sdl2
  File "/usr/local/lib/python3.3/dist-packages/sdl2/__init__.py", line 11, in <module>
    from .events import *
  File "/usr/local/lib/python3.3/dist-packages/sdl2/events.py", line 5, in <module>
    from .keyboard import SDL_Keysym
  File "/usr/local/lib/python3.3/dist-packages/sdl2/keyboard.py", line 7, in <module>
    from .video import SDL_Window
  File "/usr/local/lib/python3.3/dist-packages/sdl2/video.py", line 256, in <module>
    SDL_GL_ResetAttributes = _bind("SDL_GL_ResetAttributes")
  File "/usr/local/lib/python3.3/dist-packages/sdl2/dll.py", line 84, in bind_function
    (funcname, self._dll))
ValueError: could not find function 'SDL_GL_ResetAttributes' in <CDLL 'libSDL2-2.0.so.0', handle 1088720 at 7fdce18f5910>

My only thought is that possibly there's some version mismatch in packages? 我唯一的想法是软件包中可能存在某些版本不匹配? I couldn't find anything referencing this bug after a quick googling. 快速搜寻后,找不到任何与此错误相关的参考。

This is a bug in pysdl2, which indicates that your SDL2 library version is not the latest one. 这是pysdl2中的一个错误,表明您的SDL2库版本不是最新版本。 (2.0.3). (2.0.3)。 It has been fixed in a recent commit: https://bitbucket.org/marcusva/py-sdl2/commits/03870c58615b115abf14b11056bbcd41652873c5 它已在最近的提交中修复: https : //bitbucket.org/marcusva/py-sdl2/commits/03870c58615b115abf14b11056bbcd41652873c5

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

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