Im trying to install pygame on spyder
&
So i want this to work specidically in the newest version of spyder(spyder3)(maybe with pythonpathmanager
You don't install Pygame for Spyder, it's a Python module, so you install it for a particular Python interpreter (or for various).
i have tried pip, conda but every time when i import it i get the error no module named pygame
There's nothing to import, you never installed the module because of UnsatisfiableError.
UnsatisfiableError: The following specifications were found to be in conflict: - pygame -> python 2.7 -> openssl 1.0.1* - python 3.6**
That particular conda package you are trying to download seems to depend on python 2.7, if you download the tarball, you can check the info/index.json file, it marks python 2.7* as dependency.
Installing with pip
1) Activate the virtual environment where you want to install Pygame or, if you are not using environments, make sure that you are using the Python interpreter for which you want to install the module, do this with which python
, it should point to your intended interpreter.
Note: The location to where pip installs modules depends on the selected Python interpreter. The Python interpreter you use and the launched spyder instance depend on their precedence on your PATH. If you use environments, these aren't problems, because the env tool (conda
, venv
, virtualenv
, &c) will modify the PATH as needed.
2) pip install pygame
, add sudo
if you intend to install for the system's default interpreter on /usr/bin/python.
That's it, you should be able to import it.
Additional notes:
If you are interested in using the PyPi package (this is what pip installs), but manage it with conda, then you need to build a conda package.
If you have already installed Pygame somewhere and wants to use it with a Python interpreter that doesn't know about it, you can use the PYTHONPATH environment variable to let Python know from where else it can try to find it. This may not be such a good idea depending on the situation.