Error

Michael Torrie torriem at gmail.com
Sun Dec 6 18:09:42 EST 2020


On 12/5/20 11:41 AM, Barry Fitzgerald via Python-list wrote:
> Good day,"
> 
> I purchased a book for my son and followed the directions to a T.
> (Coding Games in Python) Whenever I got to the point of of moving the
> "hello" file over to pgzrun is where my trouble began. Its not
> finding a path because I'm getting this "pgzrun is not recognized as
> an internal or external command".
> 
> I've uninstall reinstall and tried to trouble shoot offline.  I'
> believe its a "path" issue but that is a little over my head.  At
> least this is what I've read.  Yes I selected all users and the
> variables options on custom install.
Looks to me like you have to do two things to get PyGame Zero going on
Windows.  First, install the latest stable Python 3 from python.org.  Be
sure to tell the installer to put Python in the system path so you can
get to it from the command prompt.

Second, from a command prompt, run:

py -m pip install pgzero

And then you must put the location pgzrun.exe in your path.  See below.

For example this is what you'd see:
C:\Users\torriem>py -m pip install pgzero
Collecting pgzero
  Using cached
https://files.pythonhosted.org/packages/48/e5/e5f14292373cb5fc7539aa01307b184c1e3c954d68945d8c44778669dd82/pgzero-1.2-py3-none-any.whl
Collecting numpy (from pgzero)
  Using cached
https://files.pythonhosted.org/packages/40/db/5060f18b0116f00ee73f8365efc9c95bd5496946290b0e7c97b6ee89dffe/numpy-1.19.4-cp38-cp38-win_amd64.whl
Collecting pygame<2.0,>=1.9.2 (from pgzero)
  Using cached
https://files.pythonhosted.org/packages/a8/1e/5da797179ce046decc7d6d57a9b1977218103ccfb099b959b7736aff5f73/pygame-1.9.6-cp38-cp38-win_amd64.whl
Installing collected packages: numpy, pygame, pgzero
  WARNING: The script f2py.exe is installed in
'C:\Users\torriem\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts'
which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress
this warning, use --no-warn-script-location.
  WARNING: The script pgzrun.exe is installed in
'C:\Users\torriem\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts'
which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress
this warning, use --no-warn-script-location.
Successfully installed numpy-1.19.4 pgzero-1.2 pygame-1.9.6
WARNING: You are using pip version 19.2.3, however version 20.3.1 is
available.
You should consider upgrading via the 'python -m pip install --upgrade
pip' command.

Note the WARNINGs about the scripts and path. You'll want to take that
directory (which will be different on your machine) and add that to the
path.  See
https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/
for an example of how to do that.

In my case, the path I need to add is
C:\Users\torriem\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts

After that, pgzrun should run as the book says it will.


More information about the Python-list mailing list