How to solve the "pip install pygame" issue?
Asked Answered
N

4

2

I am trying to use command pip install pygame in cmd, but there is error. The error is shown as follows:

C:\Users\Administrator>pip install pygame
Collecting pygame
  Using cached https://files.pythonhosted.org/packages/80/2c/3a52e7e9c097229b026b4efbe6711c600f3a84ffdc5f11fd9e7f8932368e/pygame-1.9.6-cp37-cp37m-win32.whl
Installing collected packages: pygame
Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'c:\\program files (x86)\\python37-32\\Lib\\site-packages\\pygame'
Consider using the `--user` option or check the permissions.

You are using pip version 18.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

I follow the instruction in the error but still cannot solve the problem. And I also found whatever "pip" command cannot be installed correctly.

Nobell answered 23/6, 2019 at 3:22 Comment(2)
Possible duplicate of pip install -r: OSError: [Errno 13] Permission deniedTuition
stackoverflow.com/…Tuition
I
1

You can install the package as Administrator, by following these steps:

1.Right click on the Command Prompt icon 2.Select the option: Run This Program As An Administrator 3.Run the command: pip install pygames

Instead of you can use the command pip install --user pygames

Impertinent answered 23/6, 2019 at 3:36 Comment(1)
Using cached files.pythonhosted.org/packages/80/2c/… Installing collected packages: pygame Successfully installed pygame-1.9.6 You are using pip version 18.1, however version 19.1.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.Nobell
R
0

The other answers didn't work for me. I checked this site and made sure that pip, setuptools, and ez_setup were installed at the latest versions. Still no luck. Finally, I discovered the magic words here:

pip install pygame --pre

Per this, --pre option tells pip to include pre-release versions of packages when searching for the latest version. Apparently that's what's needed as of this writing (2023-02-08).

(Thanks to accddd)

Rachael answered 9/2, 2023 at 4:52 Comment(2)
Running as administrator and updating pip did not work for me, but this did. Thanks!Seeder
As of 3/5/2023, the --pre is no longer requiredRachael
C
-1

check if Pip was installed correctly by opening a command prompt and entering the following command:

pip -V

output should be like:

 pip 18.0 from c:\users\administrator\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)

if pip is not install copy this file link and save it to setup.py now open cmd and run script by typing

python setup.py

for more details check link.

when pip in install correctly install run this commond

python -m pip install -u pygame --user
Comprador answered 23/6, 2019 at 3:37 Comment(0)
T
-1

For this, you have to install pygame package from the cmd (on Windows) or from the terminal (on mac). Just type pip install pygame.If it doesn't work for you, then try using this statement pip3 install pygame. If it is still showing an error then you don't have pip installed on your device and try installing pip first.

Tonina answered 2/9, 2020 at 11:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.