electronstudio / raylib-python-cffi

Python CFFI bindings for Raylib
http://electronstudio.github.io/raylib-python-cffi
Eclipse Public License 2.0
142 stars 29 forks source link

No module named 'raylib.static._raylib_cffi' #29

Closed ChildishGiant closed 3 years ago

ChildishGiant commented 3 years ago

I installed with PIP and get this error when running

  File "E:\code\games\raylib\py\example.py", line 1, in <module>
    from raylib.static import *
  File "C:\Python39\lib\site-packages\raylib\static\__init__.py", line 1, in <module>
    from ._raylib_cffi import ffi, lib as rl
ModuleNotFoundError: No module named 'raylib.static._raylib_cffi'

Here's the example code I'm using

from raylib.static import *

InitWindow(800, 450, b"Hello Raylib")
SetTargetFPS(60)

camera = ffi.new("struct Camera3D *", [[18.0, 16.0, 18.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], 45.0, 0])
SetCameraMode(camera[0], CAMERA_ORBITAL)

while not WindowShouldClose():
    UpdateCamera(camera)
    BeginDrawing()
    ClearBackground(RAYWHITE)
    BeginMode3D(camera[0])
    DrawGrid(20, 1.0)
    EndMode3D()
    DrawText(b"Hellow World", 190, 200, 20, VIOLET)
    EndDrawing()
CloseWindow()
electronstudio commented 3 years ago

I think the version on pip is out of date - only the github version supports Python 3.9. Someone was going to make new, better architecture specific pip packages but I don't know what happened with that.

electronstudio commented 3 years ago

I have made architecture specific packages for Raylib 3.5 on Python 3.9 on Linux. On other platforms such as Windows pip will attempt to build from source automatically but I expect that won’t work unless you have Visual Studio setup. If someone could do a Windows build I will upload.

electronstudio commented 3 years ago

I did some windows builds and put them on pypi, so this should be fixed.

ChildishGiant commented 3 years ago

Yep that's fixed it!