SDL.dll does not sound like the correct DLL. Did you really download SDL2, not SDL? If so, you can put SDL2.dll into a directory of your choice and let your environment point to it:
os.environ["PYSDL2_DLL_PATH"] = "c:\\directory\of\\sdl2\\library"
Actually what you need to do, is to have dll, so just pip install it
pip install pysdl2 - dll
I’m starting to use PySDL2 with Python 3.4 to make a game. Every time I run the “hello world” code given by the PySDL2 documentation it looks like I haven’t installed the SDL library:,You also should make sure that your Python installation matches the SDL2 build. If you use a 32-bit SDL2.dll, Python also must be a 32-bit build. If you use a 64-bit SDL2.dll, Python also must be a 64-bit build.,AND I’ve tried to even put the SDL.dll file in the System32 folder (btw I’m in a Windows x64 machine) I need help, so if you can’t answer because there’s not enough information just tell me,I have already tried to make a batch file to set the environment var:
I’m starting to use PySDL2 with Python 3.4 to make a game. Every time I run the “hello world” code given by the PySDL2 documentation it looks like I haven’t installed the SDL library:
ImportError: could not find any library
for SDL2(PYSDL2_DLL_PATH: unset)
set PYTHONPATH = C: \path\ to\ pysdl2\: $PYTHONPATH
and also tried to set the environment var through IDLE:
os.environ["PYSDL2_DLL_PATH"] = "path"
SDL.dll does not sound like the correct DLL. Did you really download SDL2, not SDL? If so, you can put SDL2.dll into a directory of your choice and let your environment point to it:
os.environ["PYSDL2_DLL_PATH"] = "c:\\directory\of\\sdl2\\library"
Actually what you need to do, is to have dll, so just pip install it
pip install pysdl2 - dll
The sdl2 package relies on an external SDL2 library for creating the wrapper functions. This means that the user needs to have SDL2 installed or that you ship a SDL2 library with your project.,At present, pysdl2-dll does not provide binaries for Linux or other Unix-like OSes due to a lack of official pre-compiled releases, though Linux support may be added in the future with an appropriate build script and buildbot. On these platforms, you can require users to install the latest available SDL2 binaries using their preferred package manager.,Note that although it only provides binaries for certain platforms, pysdl2-dll will install without error on any OS, making it safe to add as a dependency for cross-platform projects.,The SDL2 libraries are designed to be highly consistent across platforms, but there are some occasional bugs/issues with certain common binaries that can result in unexpected problems. Here are the ones we are currently aware of:
# Win32 platforms set PYSDL2_DLL_PATH = C: \path\ to\ fancy_project\ third_party # Unix / Posix - alike environments - bourne shells export PYSDL2_DLL_PATH = /path/to / fancy_project / third_party # Unix / Posix - alike environments - C shells setenv PYSDL2_DLL_PATH / path / to / fancy_project / third_party # Define multiple paths to search for the libraries - Win32 set PYSDL2_DLL_PATH = C: \first\ path; C: \second\ path
dllpath = os.path.join('path', 'to', 'fancy_project', 'third_party')
os.environ["PYSDL2_DLL_PATH"] = dllpath
if not(sdl2.dll.version >= 2008 and sdl2.sdlttf.dll.version >= 2015):
err = ("This project requires SDL2 >= 2.0.8 and SDL2_ttf >= 2.0.15. "
"Please update your SDL2 binaries and relaunch.")
raise RuntimeError(err)
Because the wheels are not built against any specfic version of Python, pysdl2-dll supports all versions and implementations of Python that are supported by PySDL2.,pysdl2-dll is a Python package that bundles the SDL2 binaries in pip-installable form for macOS and Windows, making it easier to create and run scripts/packages that use the PySDL2 library.,The pysdl2-dll package can be installed on platforms other than the ones listed above, but it won't have any effect.,Note: pysdl2-dll is currently not built with libdecor support, meaning that native Wayland (non-XWayland) window decorations will be unavailable when using these binaries (see issue #9 for details). Given that SDL2 defaults to using XWayland this shouldn't be an issue for most users, but suggestions and/or PRs to fix the issue are welcome!
You can install the latest version of pysdl2-dll via pip:
pip install pysdl2 - dll # install latest release version
pysdl2-dll requires PySDL2 0.9.7 or later in order to work correctly on macOS, and for PySDL2 to load the binaries automatically when available. To update to the latest PySDL2, you can run:
pip install - U pysdl2
pysdl2-dll is a Python package that bundles the SDL2 binaries in pip-installable form for macOS and Windows, making it easier to create and run scripts/packages that use the PySDL2 library.,Because the wheels are not built against any specfic version of Python, pysdl2-dll supports all versions and implementations of Python that are supported by PySDL2.,The pysdl2-dll package can be installed on platforms other than the ones listed above, but it won't have any effect.,To override pysdl2-dll and use a different set of binaries, you can set the PYSDL2_DLL_PATH environment variable to the path of the folder containing the binaries you want to use instead, or alternatively set it to "system" to force PySDL2 to use the system install of SDL2 if available (e.g. SDL2 installed with brew on macOS).
Update Image, Mixer, and TTF to latest, add Universal2 wheels(#16) * Try updating addon libraries to new releases * Try updating getdlls.py for new file structures * Fix handling of optional external libs * Allow external libs missing versions in dirname * Generate configure if it doesn't exist * Ignore tremor library * Try building mixer/image and their deps with CMake * Allow missing libz, move TTF to cmake * Try fixing relative RPATH support with CMake * Fix linking of opusfile to libogg and libopus * Fix library prefix for 64-bit Linux * Work around upstream bug in mixer's CMakeLists * Clean up unused code * Fix bug in code cleanup * Try including debug symbols with CMake * Try fixing WebP on i686 * Update version number * Try packaging macOS wheels as universal2 * Fix 32-bit arch checks for linux * Update README for universal2 wheels * Disable SSE4.1 requirement for WebP * Actually fix WebP on older CPUs * Disable CMake debug build on release tag * Update README * Fix check for CIRRUS_TAG * Actually fix handling of CIRRUS_TAG
Update pip update message for Universal2
Add back optional decoders on macOS(#17)
Release 2.0 .22.post1
Try fixing release mode for Linux
You can install the latest version of pysdl2-dll via pip:
pip install pysdl2 - dll # install latest release version
pysdl2-dll requires PySDL2 0.9.7 or later in order to work correctly on macOS, and for PySDL2 to load the binaries automatically when available. To update to the latest PySDL2, you can run:
pip install - U pysdl2
ImportError: could not find any library for SDL2 (PYSDL2_DLL_PATH: /Python34/Lib /site-packages/PySDL2-0.9.3/sdl2),So I ran pip install PySDL2, and that said: C:\Python34\Lib\site-packages\PySDL2-0.9.3>pip install pysdl2 Requirement already satisfied (use --upgrade to upgrade): pysdl2 in c:\python34\ lib\site-packages Cleaning up...,I downloaded pySDL2 (from https://bitbucket.org/marcusva/py-sdl2/downloads) and unzipped the SDL2 package to my folder C:\Python34\Lib\site-packages\PySDL2-0.9.3, which has a subfolder sdl2 which has a subfolder ext.,So, I have the package in the python library, I have it pointed to in the environment, and pip says its already there, but somehow python can't find it to import.
I also copied a 'hello world' program to the same folder, using the header:
import os
os.environ["PYSDL2_DLL_PATH"] = "/Python34/Lib/site-packages/PySDL2-0.9.3"
import sys
import sdl2.ext