如何在 RedHat 上安装 pyautogui 模块

Tou*_*sah 5 python linux pip yum

我一直在 Windows 上使用 Python 模块 pyautogui,它的安装相当简单,需要将它安装在 RedHat 服务器上才能工作。

官方文档给出了以下Linux安装说明:

pip3 install python3-xlib

sudo apt-get install scrot

sudo apt-get install python3-tk

sudo apt-get install python3-dev

pip3 install pyautogui
Run Code Online (Sandbox Code Playgroud)

现在,有两件事困扰着我:

1) 它假定使用 Python 3,但我们使用的是 Python 2。这是否意味着该模块仅适用于 Linux 中的 Python 3?因为我一直在 Windows 上将它用于 Python 2。

2) 依赖方面,它假设使用 Debian 的包管理器 APT,当然这些依赖应该在带有 yum 的 RedHat 系统上可用。

我首先决定安装 python-xlib,它是第一个包的 Python 2 版本,它工作正常。

其次我试过:

sudo yum install scrot
Run Code Online (Sandbox Code Playgroud)

这导致错误“没有可用的包 Scrot”。以这种方式找到了死胡同,我尝试手动下载 Scrot 的源代码并安装它。

我按照说明操作:

$ wget http://linuxbrit.co.uk/downloads/scrot-0.8.tar.gz
$ tar -xvf scrot-0.8.tar.gz
$ cd /scrot-0.8
$ ./configure --prefix=/usr
$ make
$ su -c "make install"
Run Code Online (Sandbox Code Playgroud)

这只会导致出现错误

checking whether to enable maintainer-specific portions of Makefiles... no
checking for giblib-config... no
checking for giblib - version >= 1.2.3... no
*** The giblib-config script installed by giblib could not be found
*** If giblib was installed in PREFIX, make sure PREFIX/bin is in
*** your path, or set the GIBLIB_CONFIG environment variable to the
*** full path to giblib-config.
configure: error: Cannot find giblib: Is giblib-config in the path?
Run Code Online (Sandbox Code Playgroud)

我发现一些线程解决了这个问题,并粗略地要求安装 giblib。然而,我没有这样做。同样,我只找到了在类似 Debian 的系统中安装它的说明,而无法找到如何在 RedHat 系统上安装它。所以现在我正在尝试下载并安装 giblib 的源代码,但这开始变得混乱,尤其是考虑到我必须要求在我们的生产服务器上安装 pyautogui 并且我没有看到自己向我的老板这样一个巨大而笨重的程序。那马上就被拒绝了。

所以我现在寻求帮助,也许是在 RedHat 系统上为 Python 2 安装 Python pyautogui moduke 的更好或更简单的方法。或者甚至是类似的模块,我找不到任何使用起来简单高效的替代方案。

如果有人可以在这方面帮助我,那将非常有帮助,并且可以为我节省大量工作和死胡同。

小智 0

我通过以下步骤将 scrot 安装到 Centos7:

https://pkgs.org/

下载并安装:

giblib-devel-1.2.4-22.el7.psychotic.x86_64.rpm

giblib-1.2.4-22.el7.psychotic.x86_64.rpm

sudo yum --nogpgcheck 本地安装

http://scrot.sourcearchive.com/downloads/0.8-8/

下载:

scrot_0.8.orig.tar.gz

安装:

tar xvf scrot_0.8.orig.tar.gz

cd scrot-0.8/

。/配置

制作

须藤进行安装