Python Forum
beginner needs PyGame advice
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
beginner needs PyGame advice
#1
I am a beginner and want to learn Python and I want to get started the correct way. I am using Windows 10 and have installed python 3.8.

1) It was suggested on the Internet to install and use PyCharm as a good IDE and I did so. Was this a good idea?
Maybe I should use a different IDE.

2) Ultimately, I want to install and use a python, external module called PyGame. I have seen directions that say to use pip for this.
" python3 pip install pyGame.py ---user " or something like this. When I try this command, I get errors of course because I do not know where on the Internet I should go and get PyGame and how to get it, where do I put the module in my computer, and even how to involk pip. I think I am lost as to where on my computer things should be stored and how to access them. If this sounds like I am confused I am.
Reply
#2
The only thing you need to know is how to invoke pip. You do this from the system command prompt, not the python prompt. Python prompt will have >>>.pip will do the rest, find pygame, download and install pygame.

The next thing you need to know is that you need to make sure pycharm is using the correct python version you installed pygame to. Some IDEs come with python prepackaged. So if this is the case you need to point pycharm to the python interpreter that you installed pygame to.

The command is
pip install pygame
It doesn't matter what IDE you use. It's all preference.
Recommended Tutorials:
Reply
#3
Amazing I had to use the --user option to ge3t the intall to work.

I still do not know where PyGame was installed.

I would like to know what my default program directory is and how to change it.
Should I just take the defaults.

Put another way, where is the python program located., Where did he module get loaded, should I have a sepatate direcctory just for my python files? When I eventually have to use an "include" command in my python program, do I have to point to a special directory, i.e am I going to have to do something like include c:/pythosfiles/includes/ pygame or something like this?

Basically, I do not know the structure of the files
Reply
#4
You can change pythons installation directory when you install python. Within python sub directories lies a location for 3rd party libraries such as pygame. I forgot the path in windows as I use Linux.

In your script you simply put

import pygame
And python searches its directories for that library.
Recommended Tutorials:
Reply
#5
(Dec-03-2021, 10:39 PM)barryjo Wrote: Amazing I had to use the --user option to ge3t the intall to work.

I still do not know where PyGame was installed.

I would like to know what my default program directory is and how to change it.
Should I just take the defaults.
On windows if using --user it will be in eg for 3.9.
C:\users\<username>\appdata\roaming\python\python39\
Can look at this Python 3.9/3.8 and pip installation under Windows
So there you see i like simpler path like eg C:\python39
Quote:Put another way, where is the python program located., Where did he module get loaded, should I have a sepatate direcctory just for my python files?
So you see path over,OS find Python trough Environment Variables Path,when it correct python and pip command should work from anywhere in cmd.
Quote: i.e am I going to have to do something like include c:/pythosfiles/includes/ pygame or something like this?
You don't need to include pygame once it's install pip it will always works as long Windows find python as mention over.
A simple test from cmd
Microsoft Windows [Version 10.0.19043.1288]
(c) Microsoft Corporation. Med enerett.

C:\Windows\System32>cd ..

C:\Windows>cd..

# Python version
C:\>python -V
Python 3.9.5

# Pip version
C:\>pip -V
pip 21.1.3 from c:\python39\lib\site-packages\pip (python 3.9)

# Python location
C:\>python -c "import sys;print(sys.executable)"
C:\Python39\python.exe
So you can just have python files(.py ) in c:/pythosfiles/.
Then can just python my_game.py to eg run a Pygame.
Using Editors(eg VS Code, PyCharm) then may find Python automatically or you need to point to path where Python is installed.
metulburr likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question How to create .exe with PyGame [BEGINNER] PolarBear123 1 2,338 Mar-13-2020, 02:54 AM
Last Post: snippsat
  Beginner needing advice with data files JFI2019 2 2,193 Nov-06-2019, 04:56 PM
Last Post: JFI2019
  Pygame*import pygame ImportError: No module named pygame CASPERHANISCH 1 9,742 Jun-05-2017, 09:50 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020