Windows - 无法通过pip安装pyautogui - 错误:命令“python setup.py egg_info”失败,错误代码为1

问题描述 投票:0回答:2

我正在通过pip安装python包pyautogui,如下所示:

pip install pyautogui

但是,它显示错误:

    ERROR: Complete output from command python setup.py egg_info:
    ERROR: Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Winnie\AppData\Local\Temp\pip-install-dxvr5jhi\pygetwindow\setup.py", line 11, in <module>
        long_description = fh.read()
    UnicodeDecodeError: 'cp950' codec can't decode byte 0xe2 in position 903: illegal multibyte sequence
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in C:\Users\Winnie\AppData\Local\Temp\pip-install-dxvr5jhi\pygetwindow\

我在stackoverflow上搜索我的问题,我的做法与"pip install unroll": "python setup.py egg_info" failed with error code 1相同 当我尝试easy_install -U setuptools 表明:

error: [WinError 5] Permission denied: 'c:\\users\\winnie\\appdata\\local\\programs\\python\\python37-32\\Scripts\\easy_install.exe'

这是我正在使用的:

  • 操作系统:Windows 10
  • python:3.7.3
  • 点:19.1

我的电脑出了什么问题?谁能帮我? 非常感谢你

python pip pyautogui
2个回答
0
投票

可以请使用Admin角色运行命令。 pip安装pyautogui


0
投票

找到ERROR消息上方的链接:

收集pygetwindow(来自pyautogui)使用缓存的https://files.pythonhosted.org/packages/01/ed/56d4a369c6e18f6b239d9ef37b3222ba308bfebf949571b2611ff7d64f1d/PyGetWindow-0.0.4.tar.gz错误......

下载并编辑“setup.py”:

...#从模块加载版本(不加载整个模块),打开('src / pygetwindow / init.py','r',encoding =“UTF-8”)为fd:version = re.search(r '^ version \ s * = \ s * \'“[\'”]',fd.read(),re.MULTILINE)。group(1)#在README.md中读取长描述。打开(“README.md”,“r”,encoding =“UTF-8”)为fh:long_description = fh.read()...

将encoding =“UTF-8”添加到open函数arg中

重新归档tar文件,运行pip install PyGetWindow-0.0.4.tar

最后再次运行pip install pyautogui

© www.soinside.com 2019 - 2024. All rights reserved.