gpt4 book ai didi

python - 如何在 RedHat 上安装 pyautogui 模块

转载 作者:太空狗 更新时间:2023-10-29 11:21:31 26 4
gpt4 key购买 nike

我一直在 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

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

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

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

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

其次我尝试了:

sudo yum install scrot

这导致错误“没有可用的包 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"

这只会导致出现错误

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?

我发现一些线程解决了这个问题并粗略地要求安装 giblib。但是,我没有这样做。同样,我只找到了在类 Debian 系统中安装它的说明,而找不到如何在 RedHat 系统上安装它的说明。所以现在我正在尝试下载并安装 giblib 的源代码,但这开始很困惑,特别是考虑到我必须要求在我们的生产服务器上安装 pyautogui 并且我没有看到自己向我解释老大如此庞大而笨重的程序。那会立即被拒绝。

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

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

最佳答案

我遇到了完全相同的问题,陷入了缺少依赖项的循环。最后,有人帮我解决了问题。

yum install epel-release

yum install wget imlib2

wget http://packages.psychotic.ninja/7/base/x86_64/RPMS/scrot-0.8-12.el7.psychotic.x86_64.rpm

wget http://packages.psychotic.ninja/7/base/x86_64/RPMS/giblib-1.2.4-22.el7.psychotic.x86_64.rpm

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

rpm -Uvh scrot-0.8-12.el7.psychotic.x86_64.rpm

就是这样。之后我可以使用 PyAutoGUI。

关于python - 如何在 RedHat 上安装 pyautogui 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39730197/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com