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.

Moshe Slavin
  • 5,127
  • 5
  • 23
  • 38
Angelababy2018
  • 43
  • 1
  • 2
  • 6
  • Possible duplicate of [pip install -r: OSError: \[Errno 13\] Permission denied](https://stackoverflow.com/questions/31512422/pip-install-r-oserror-errno-13-permission-denied) – phd Jun 23 '19 at 12:48
  • https://stackoverflow.com/search?q=%5Bpip%5D+EnvironmentError+WinError+5 – phd Jun 23 '19 at 12:48

4 Answers4

3

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

  • 1
    Using cached https://files.pythonhosted.org/packages/80/2c/3a52e7e9c097229b026b4efbe6711c600f3a84ffdc5f11fd9e7f8932368e/pygame-1.9.6-cp37-cp37m-win32.whl 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. – Angelababy2018 Jun 23 '19 at 03:39
1

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)

circlepi314
  • 1,031
  • 10
  • 14
0

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
itsvinayak
  • 140
  • 1
  • 16
0

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.

Ansh
  • 58
  • 6