Home > Back-end >  Why can't I install python packages with pip on windows 10?
Why can't I install python packages with pip on windows 10?

Time:06-26

I have had this running battle with pip on my windows 10 PC ever since I tried to upgrade it. I tried to upgrade it with pip upgrade. After that, pip has stopped working. I wanted to install Pygame on my pc with pip install pygame and I got the following error message about my operating system:

ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\\Python310\\Include\\pygame'
Consider using the `--user` option or check the permissions.

I get the same error message anytime I try to install any python package on my pc. Please what can I do to correct this problem?

CodePudding user response:

Run Windows PowerShell as Admin then run the pip install command to install the python module or upgrade the pip.

or

Run Pip Install with --user python -m pip install --upgrade pip --user

CodePudding user response:

Just type the command you want execute with the user permission, if you don't want to change the permission:

pip install pygame --user

and if you want to change user permission then follow these steps:

Just change the access permission, where the particular package is going to install.

On Windows 10:

  • Go to the installation folder. For example: C:\Program Files (x86)\Python37
  • Right click on python installation root and click Properties. In this case, the Python37 folder.
  • Go to the Security tab, click Edit button and allow full control for the Users group. Remember to click Apply.
  • Try to install the package again.

Below is an example of desired settings: enter image description here

  • Related