I'm very new to both Python and Pygame. I have Python 3.5.1 32-bits installed on Window and Pygame 1.9.2 Python 3.5 installed as well. But in case if I forget, is there a way to check the pygame version I have installed from either command line or Python IDLE.
For Python, I use python -V
But for Pygame, I don't know how to.
Use this: pip show <pack_name>
Alternative:
pip freeze | grep <pack_name>
I know this question is a year old and has an accepted answer but I've stumbled upon another way to check the version while researching.
You basically import pygame from the command line and type this code
pygame.version.ver
or
pygame.version.vernum
The first one returns the version as a string and the second one returns it as a tuple of integers.
I found this from here
and I know this might be unnecessairy but I wanted to include it anyway.
pip show pygame // command to check your pygame details
output:
Name: pygame
Version: 1.9.4
Summary: Python Game Development
Home-page: https://www.pygame.org
Author: Pete Shinners, Rene Dudfield, Marcus von Appen, Bob Pendleton, others...
Author-email: pygame#seul.org
License: LGPL
Location: /home/linux/anaconda3/lib/python3.6/site-packages
Requires:
Required-by:
Related
I can't start PyGame Zero window from cmd. According to book I bought my kid, I suppose to start it with
pgzrun test.py
Unfortunteally what I get is:
'pgzrun' is not recognized as an internal or external command,
operable program or batch file.
As a Python begginer I started with checking my python and pygame lib:
C:\Users\mikol\OneDrive\python\examples\asteroids>python --version
Python 3.10.9
C:\Users\mikol\OneDrive\python\examples\asteroids>pip show pygame
Name: pygame
Version: 2.1.2
Summary: Python Game Development
Home-page: https://www.pygame.org
Author: A community project.
Author-email: pygame#pygame.org
License: LGPL
Location: c:\users\mikol\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages
I have also double confirmed adding
c:\users\mikol\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages
to PATH variable (using Win 11). Am I missing something?
Running:
macOS Catalina 10.15.1
Python 3.8.0
Pygame 1.9.6
IDE - Visual Studio Code 1.40.2
When I launch the Pygame test:
python3 -m pygame.examples.aliens
The music begins playing and after about 5 seconds the app closes. No window appears. The icon in dock shows up until it's closed.
The same thing happens with a basic test code such as
import pygame
pygame.init()
screen = pygame.display.set_mode((400, 300))
done = False
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
pygame.display.flip()
There are no error messages in the terminal.
Anybody have this issue? I've tried reinstalling both Python 3.8.0 from the website (as recommended in a different thread) as well as Pygame.
This solution was given by furas in this comment:
Maybe install Python 3.7. Python 3.8 is very new version and many modules are not ready or not tested for this version.
This works on Python 3.7.8.
After several trials I have found out that the problem can be solved with one of two ways, You may try each solution one by one as one have worked with some friends and other have worked with others.
My system info:
macOS Catalina 10.15.6
Python 3.8.5
All solutions depends on trying latest Pygame developer versions (knowing many would say its not final release and it might be not stable but i believe this is much better than downgrading your macOS version).
Solution A:
At Terminal, try installing Pygame dev 4
pip3 install pygame==2.0.0.dev4
This solution allow me to work with most codes but when I try some samples online
it give me this error "Sorry, extended image module required"
Solution B:
At Terminal, try installing Pygame dev 4
pip3 install pygame==2.0.0.dev6
This time it works perfectly form we for all online and offline codes
To Test result try this sample
python3 -m pygame.examples.aliens
Here is a screenshot for the previous sample after fixing the issue:
I'm a complete newbie when it comes to Python programming and I would like to dive myself into Python GUI application programming and have been trying to get Pyforms to work on my Macbook 12" 2017 running macOS High Sierra 10.13.3
I followed the instruction listed on pyforms documentation website right here on how to install it.
I installed python on my mac with this tutorial right here:
For the last 20 hours or so I've been dumbfounded by this error that I kept getting whenever I tried to run the example.py that they provided on this page
The error on the terminal whenever I tried to execute python example.py is:
Reason: Incompatible library version: QtWidgets.so requires version 5.10.0 or later, but QtWidgets provides version 5.7.0
I don't understand why this happens as I've made sure to install PyQt5 using pip install pyqt5 and it installed the latest 5.10.0 version.
I'm a total beginner when it comes to this, I tried to google a bunch of stuff and followed multiple tutorials to no avail. So now I have to turn to the professionals in stackoverflow.
Any help would be much appreciated, thank you!
When I try and use easy_install PIL it will give me the error:
File "setup.py", line 182
print "--- using Tcl/Tk libraries at", TCL_ROOT
^
SyntaxError: invalid syntax
It is extremely annoying and I have tried installing it from a package as well. I've downloaded Imaging-1.1.7 and it gives the same error. I am trying to get the Image module in Python 3.4.1. I've tried installing Pillow 2.4 but it doesn't show up in the module list when I type pydoc3.4 modules and none of the applications even detect it's existence. Please help because I am getting desperate. I am on Mac OS X 10.8.4 with Python 3.4.1.
That syntax for print only exists in Python 2.x, where print is a statement. However, it was removed entirely in Python 3.x when print became a function.
This means that your version of PIL is incompatible with Python 3.x. So, you now have two options:
Get a version of PIL that is compatible with Python 3.x. This question has more information on that.
Downgrade to Python 2.x.
I have also tried brew install PIL and pip install PIL and I encountered the same issue, because I'm using python 3.4. But I just solved the problem today. This is thanks to Ned Deily's answer above, which i need to figure out first how to do since i'm not well experienced with pip stuffs.
So to do it, you need to head over to https://pypi.python.org/pypi/Pillow/ and click the latest version. (found version 2.6.1 at the time of this writing). You should see something like Pillow-(version).tar.gz (found Pillow-2.6.1.tar.gz). Just right click it and copy link address if you're using chrome browser and type in the following in your terminal.
pip install https://pypi.python.org/packages/source/P/Pillow/Pillow-2.6.1.tar.gz#md5=4b77fb0c81bbe0c8bf90c6eea960e091
that should do the trick
So I am running Windows 8 with python 3.3 installed. I have livewires and pygame installed.
But when I run the code:
from livewires import games
games.init(screen_width = 640, screen_height = 480, fps = 50)
games.screen.mainloop()
I get an error saying... ImportError: No module name 'pygame.image'.
Does anyone know how to fix this?
Did you install pygame in the file directory of the python interpreter? But anyway pygame is not available for python 3.3 at the moment. If you want to use python 3 for coding, I would recommend 3.1.1 or 3.2, and use python 2.7.12 to compile them into an .exe file with pyinstaller, because pip is not compatible with 3.1.1 and 3.2. You can also write the code in python 2. I would recommend 2.7.12
If you read the README.md file in the distro's module directory, you'll see that it was committed on September 25, 2013 and specifically states:
You will need Python to use the package. Python can be obtained from: http://www.python.org/download/. If you're installing for the first time, we recommend you use Python 2.2.3
I think it's quite likely that livewires will not work with Python 3.