每当我尝试安装pygame时,cmd pip都会显示错误

时间:2018-09-02 14:44:39

标签: python pip pygame windows-10

我在Windows 10系统上,最近安装了最新版本的python python 3.7.0。我启用了PATH,并尝试通过CMD安装pygame。

我首先输入pip,它像往常一样工作。

然后我尝试pip install pygame

现在,这就是问题所在。

CMD提出了这一点:

Collecting pygame
  Using cached https://files.pythonhosted.org/packages/b0/30/4df62b0eb0f09a8ad1c329ff5479b3b115e8dce25475fd0c2f73cb790aa4/pygame-1.9.4-cp37-cp37m-win32.whl
Installing collected packages: pygame
Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\program files (x86)\\python37-32\\Lib\\site-packages\\pygame'
Consider using the `--user` option or check the permissions.

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

所以我输入python -m pip install --upgrade,然后发生这种情况:

Collecting pip
  Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\program files (x86)\\python37-32\\lib\\site-packages\\pip-10.0.1.dist-info\\entry_points.txt'
Consider using the `--user` option or check the permissions.

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

为什么要这样做? 有人请帮助我,谢谢你。

1 个答案:

答案 0 :(得分:3)

“拒绝访问”表示您没有足够的权限来更改Python安装的全局设置。

打开具有Adminstrator权限的cmd行,或者更好的方法:了解如何使用Python虚拟环境:https://docs.python-guide.org/dev/virtualenvs/