How can I install pygame for python3 using pip? I have Python version 3.6.3.
I tried with pip install pygame
but it was installed on python 2.7.
Thanks.
How can I install pygame for python3 using pip? I have Python version 3.6.3.
I tried with pip install pygame
but it was installed on python 2.7.
Thanks.
I finally solved it with:
Source: https://stackoverflow.com/questions/42707566/how-to-install-pygame-for-python3-5-in-ubuntu16-04
To install pygame, follow these steps:
C:\Users\Fran\Python\Scripts
In CMD, it would be:
cd C:\Users\Fran\Python\Scripts
pip install Pygame
Result:
You say you have python3, but instead
pip
you have it installed for python2, from which it follows that you also have python2.The best way to avoid a mess when you have multiple versions of python installed on your system is to use a virtual environment . Actually, although the name is a bit intimidating, it is nothing more than a folder with a specific version of python inside it and in which you can install packages that do not affect the system or other similar folders that you have created for other projects or tests. .
The steps are very simple:
Create the folder (virtual environment):
This runs
python3
(thus making sure the virtual environment will be for this version) and loads the modulevenv
, which will create the folder~/entornos/game
and put in several folders with that version of python and its libraries, as well as an appropriate version ofpip
. You can call the folder whatever you like, but it's good practice to create them all in one place so they're easy to find. In this case I have assumed that you want to create them all inside the folderentornos
of your user root directory.activate the environment
As long as you do not activate the environment, when using it from the command line
python
orpip
the system ones will continue to be used. To activate it you must put:You'll see your prompt change to now
(game) $
, as a reminder that you've activated that virtual environment. Now when you dopip install
, the onepip
from that environment will run, and whatever it installs will do it inside that folder, without affecting the rest of the system. When youpython
execute it, the one in that folder will be executed and therefore it will find the packages installed there.disable the environment
When you want to use system python again (for example, to create another virtual environment), just type:
The prompt will return to its normal form to remind you that you are no longer in the virtual environment. The command
python
will revert to the system default (and you will no longer have access to the packages you had installed while in the virtual environment).The environment is also abandoned if you close the terminal. This implies that every time you open a new terminal to work in that environment you must activate it again as indicated above.
could you try with
I hope it works for you
I don't know about you but I almost died trying so I put pip install Pygame with the p in capital letters and from proto everything lit up I pulled wonderfully
when I gave it pip list there it was, I don't know why in pycharm it asks for it with lowercase completely and never installs it
You can try with:
If the latest version is not downloaded, with the following command you can Update:
This was done on Windows 10. It is very important that you are doing this within the user where Python is installed.