|
15 | 15 |
|
16 | 16 | Tested configurations:
|
17 | 17 | - Windows 7: SDL 2.0.7 and PySDL2 0.9.6
|
| 18 | +- Mac 10.9: SDL 2.0.7 and PySDL2 0.9.6 |
18 | 19 | - Fedora 26: SDL2 2.0.7 with PySDL2 0.9.6
|
19 | 20 | - Ubuntu 14.04: SDL2 with PySDL2 0.9.6
|
20 | 21 |
|
21 | 22 | Install instructions:
|
22 | 23 | 1. Install SDL libraries for your OS, e.g:
|
23 | 24 | - Windows: Download SDL2.dll from http://www.libsdl.org/download-2.0.php
|
24 | 25 | and put SDL2.dll in C:\Python27\ (where you've installed Python)
|
| 26 | + - Mac: Install Homebrew from https://brew.sh/ |
| 27 | + and then type "brew install sdl2" |
25 | 28 | - Fedora: sudo dnf install SDL2 SDL2_ttf SDL2_image SDL2_gfx SDL2_mixer
|
26 | 29 | - Ubuntu: sudo apt-get install libsdl2-dev
|
27 | 30 | 2. Install PySDL2 using pip package manager:
|
@@ -60,20 +63,32 @@ def die(msg):
|
60 | 63 | # noinspection PyUnresolvedReferences
|
61 | 64 | from cefpython3 import cefpython as cef
|
62 | 65 | except ImportError:
|
63 |
| - die("""ERROR: cefpython3 package not found\n |
64 |
| - To install type: `pip install cefpython3`""") |
| 66 | + die("ERROR: cefpython3 package not found\n" |
| 67 | + " To install type: pip install cefpython3") |
| 68 | + |
65 | 69 | try:
|
66 | 70 | # noinspection PyUnresolvedReferences
|
67 | 71 | import sdl2
|
68 | 72 | # noinspection PyUnresolvedReferences
|
69 | 73 | import sdl2.ext
|
70 |
| -except ImportError: |
71 |
| - die("ERROR: SDL2 package not found\nTo install type: `pip install PySDL2`") |
| 74 | +except ImportError as exc: |
| 75 | + excstr = repr(exc) |
| 76 | + if "No module named sdl2" in excstr: |
| 77 | + die("ERROR: PySDL2 package not found\n" |
| 78 | + " To install type: pip install PySDL2") |
| 79 | + elif ("could not find any library for SDL2" |
| 80 | + " (PYSDL2_DLL_PATH: unset)" in excstr): |
| 81 | + die("ERROR: SDL2 package not found.\n" |
| 82 | + " See install instructions in top comment in sources.") |
| 83 | + else: |
| 84 | + die(excstr) |
| 85 | + |
72 | 86 | try:
|
73 | 87 | # noinspection PyUnresolvedReferences
|
74 | 88 | from PIL import Image
|
75 | 89 | except ImportError:
|
76 |
| - die("ERROR: PIL package not found\nTo install type: pip install Pillow") |
| 90 | + die("ERROR: PIL package not found\n" |
| 91 | + " To install type: pip install Pillow") |
77 | 92 |
|
78 | 93 |
|
79 | 94 | def main():
|
|
0 commit comments