pip 无法正确更新或安装模块

pip 无法正确更新或安装模块

我尝试过好几个不同的软件包,也尝试过升级 pip。我确实

C:\Users\Michael>pip install pillow
Collecting pillow
  Downloading https://files.pythonhosted.org/packages/40/f2/a424d4d5dd6aa8c26636969decbb3da1c01286d344e71429b1d648bccb64/Pillow-6.0.0-cp37-cp37m-win_amd64.whl (2.0MB)
    100% |████████████████████████████████| 2.0MB 1.8MB/s
Installing collected packages: pillow
Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\program files\\python37\\Lib\\site-packages\\PIL'
Consider using the `--user` option or check the permissions.

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

答案1

仔细分析一下这条信息:

Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\program files\\python37\\Lib\\site-packages\\PIL'
Consider using the `--user` option or check the permissions.

这意味着您的用户无权在上述目录中创建文件。您需要以管理员用户身份运行终端或仅运行命令。或者,您可以将标志添加--user到命令中(例如,pip install --user pillow)以将程序安装在您的用户拥有的目录中。这将使该程序仅供该用户使用。

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

这只是一条通用消息,暗示有更新版本的 Pip 可用,并敦促您升级。相同的权限问题将适用于它建议运行的命令。

相关内容