*** note this is a rough draft of the steps taken to install on a windows 10 laptop, and some commentary. The tutorial has been started for my nephew who is working on a pygame school project. The goal is to keep this short and simple.
—- I’m dsylexic, and a linux user, check the slashes in my notes, I may get them backwards when I’m writing up the notes.
Step 1 – Easy to remember paths.
Create a directory in C or on another drive called Compilers.
In the Compiler directory, create the directories PyGame, Python, and Eclipse.
** this is to simplify the path to the files you will need to access later.
Change the install directory to be the Compilers\Python directory you just created.
More detailed python install directions here (Insert link later).
In the terminal windows in your Compilers/Python directory type this command:
pip install –upgrade setuptools
***** This program helps you install and manage packages for python.
Install to default locations.
MS Visual Studio Build Tools
Install these next to avoid errors later.
The error at this time tells us to go to https://visualstudio.microsoft.com/visual-cpp-build-tools/
It redirects to here: https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16
(these may change in the future, go with the flow, see where you end up, click around if you have to, to find what you need.)
It will prompt you to download an installer (vs_BuildTools.exe), which you will run after it’s downloaded.
Then the program will load the “Visual Studio Installer”.
Select “Universal Windows Platform build tools” in the left hand box.
Then on the right select two additional items for game development, they are from previous years, and provide backwards compatibility for different libraries. (Sorry I already have everything installed so I can’t give you a screen shot. Just read the list that loads on the right and it should mention game development and a year. 2015 2017 or something like that. ) When you have the right packages selected and start the install, the total space required will be over 2 Gigs. )
Let it download, then install. It can take a couple hours if your internet is slow, or your computer is slow. Be patient.
Install PyGame – Using GitHub
***** Only install pygames one way, either use github and the manual install or pip. do not use both.
** If you do this out of order, you will probably get an error at the end of the install, I’ve included that solution above, to save you some frustration. (err: build tools for ms visual studio)
In a browser search for “GitHub Pygames” and you should end up at this account. (Including the search in case the url changes in the future.)
Click the “Code” button, and copy the URL. It will look like this “https://github.com/pygame/pygame.git”
In GitHubDesktop, select “File, Clone Repository”
On the new dialog box, click “URL”, then enter the URL in the first text field.
In the second text field select the “Compiler\Pygames” directory you created. Click Clone.
You ask: (Why are we downloading from github instead of pygame.org?
— see https://www.pygame.org/download.shtml )
Answer: At the time of this tutorials creation the most recent version available on this page is pygame-1.9.6.tar.gz ~ 3.1M, and this package uses a bitbucket account as part of the build process that is no longer available. The installs fails. The github version is 2.0.1 and it has updated links to download the packages from the pygames server instead.
—Start a terminal window (Click the windows button, type “term” , click the “Command Prompt” app.
Type the command “python setup.py”
Type “Y” twice as prompted.
Then it should install to a successful completion.
———- To test a pygame, “python -m pygame.examples.aliens”
If it runs you have installed pygame successfully.
Navigating Command Line in Windows.
You will normally be dumped into the terminal in your user directory. If you created your ” Compilers\PyGame” directory on the “C:” drive. Then you can change directory with the command “cd c:\Compilers\PyGame”
Install PyGames using PIP
Start a terminal window (Click the windows button, type “term” , click the “Command Prompt” app.
“cd” to your Pygames directory.
py -m pip install -U pygame --user
To test that pygames is working run this command. If the game runs it’s installed.
py -m pygame.examples.aliens
Search/Google “eclipse download windows” you should end up here roughly. https://www.eclipse.org/downloads/
There should be a Download button for the latest version of Eclipse. This is a basic installer. Download and run it.
It will then give you a choice of which compiler you will be working with. Python does not have it’s own option on this menu (at the time of this tutorial). You choose the C++ build or the PHP Build. Either will work.
Let it install, but change the directory to be the one you created “Compiler/Eclipse”.
After it installs, “Launch” the program.
Then click “Help” and “Eclipse Marketplace”
Use the search feature on the new dialog box to search for either “python” or “pydev”.
Install “PyDev – Python IDE for Eclipse”
Agree to the TOS prompts.
Rough notes —
Next in Eclipse, select “File, New Project”
Select a python project.
Select configure path to compiler (“Please configure an interpreter before proceeding.”)
** This is just a quick way to get the path configured.
Click on “new” (it’s the first button on the right) and the option “Browse for python”
Then select your path to python should be similar to “Compiler/Python/python.exe”
It will scan the directory and come back with a list.
If pygames has installed correctly, and python recognizes it, then under libraries you should see pygame.
If not add the path to “Compilers/PyGame”. — this is the part that was not working correctly for us when we compield a pygame pacman game. ran out of time to research it.
— pausing will come back tomorrow —
Goal for tomorrow, finish my notes, and work on the eclipse and pygame path issue.
If you are still getting errors in eclipse or in the command line and they are: ModuleNotFoundError: No module named 'pygame._view' OR ModuleNotFoundError: No module named 'pygame.base'
Solution: ModuleNotFoundError: No module named ‘pygame._view’
_view is not used anymore.
Change the line of your code from “import pygame._view” to “import pygame”
Solution: ModuleNotFoundError: No module named ‘pygame.base’
You’ve installed the wrong version of pygame for your version of python, or you have to many version of pygame installed and it’s confusing python.
- use pip to uninstall and reinstall pygame.
pip uninstall pygame
pip cache purge
pip install pygame