如何在RedH上安装pyautogui模块

2024-05-16 23:12:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在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)它假设使用Python3,但我们使用的是Python2。这是否意味着该模块只存在于Linux中的python3?因为我一直在Windows上的Python2上使用它。在

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

我首先决定安装pythonxlib,这是第一个包的python2版本,它起作用了。在

其次,我尝试了:

^{pr2}$

这导致错误“没有可用的软件包”。找到一个死胡同,我试图手动下载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 pyautogui moduke for python2。我甚至找不到任何一个模块的替代品。在

如果有人能在这方面帮助我,那将是非常有帮助的,将节省我大量的工作和死胡同。在


Tags: 模块installconfiggetmake系统sudoapt
2条回答

在用python3安装PyAutoGUI的过程中,我遇到了Xlib的问题,我设法解决了这个问题,我想在这里分享这个问题,题目是“在linux RedHat上安装PyAutoGUI” 用python3安装PyAutoGUI的错误如下

Xlib.error.XauthError: ~/.Xauthority: [Error 2] No such file or directory: '/home/username/.Xauthority'

要正确安装PyAutoGUI,请执行以下操作:

方式1 首先,安装Xlib

^{pr2}$

之后,安装牵引组件

pip install PyUserInput
pip install PyAutoGUI

如果这不适合您,请在PyUserInput和PyAutoGUI之前安装python3xlib

pip install python3-xlib

方式2pkgs.org下载(xvfb run)并用以下命令安装它

rpm -ivh yourfile.rpm

然后在xvfb run的帮助下,您可以安装甚至使用PyAutoGUI代码而不会出错。。。在

xvfb-run pip install PyAutoGUI

方式3 安装其中一个(python3xlib | | pythonxlib)

pip install python3-xlib

然后呢

export DISPLAY=:0
pip install PyAutoGUI

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

https://pkgs.org/

下载和安装:

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

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

sudo yum nogpgcheck本地安装

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

下载:

0.8升。原始焦油gz在

安装:

焦油xvf scrot_0.8。原始焦油gz在

cd scrot-0.8/

/配置

制造

sudo make安装

相关问题 更多 >