使用枕头时出现奇怪的版本字符串/数字错误

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

这个简单的Python程序:

import pyautogui

# Get the screen size
screen_size = pyautogui.size()

# Capture the screen and save it to a file
screenshot = pyautogui.screenshot()
screenshot.save("screenshot.png")

pyscreeze 出现一个非常奇怪的错误:

% python3 screenshot.py
Traceback (most recent call last):
  File "/Users/ken/Programs/Neil/screenshot.py", line 7, in <module>
    screenshot = pyautogui.screenshot()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyscreeze/__init__.py", line 527, in _screenshot_osx
    if tuple(PIL__version__) < (6, 2, 1):
TypeError: '<' not supported between instances of 'str' and 'int'

我尝试过的:

  1. pip3 install --升级枕头 这把它带到了枕头-10.0.0.
  2. 更新pyscreeze到最新 这会出现下面的奇怪错误,但是对 pyautogui 的更新然后就顺利进行了。这些都不能解决原来的 str / int 问题。

请告诉我如何解决此类错误。

% pip3 install pyscreeze
Collecting pyscreeze
  Using cached PyScreeze-0.1.29-py3-none-any.whl
Collecting pyscreenshot (from pyscreeze)
  Using cached pyscreenshot-3.1-py3-none-any.whl (28 kB)
Requirement already satisfied: Pillow>=9.2.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pyscreeze) (9.5.0)
Requirement already satisfied: EasyProcess in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pyscreenshot->pyscreeze) (1.1)
Requirement already satisfied: entrypoint2 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pyscreenshot->pyscreeze) (1.1)
Requirement already satisfied: mss in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from pyscreenshot->pyscreeze) (9.0.1)
Installing collected packages: pyscreenshot, pyscreeze
**ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.**
pyautogui 0.9.54 requires pygetwindow>=0.0.5, which is not installed.
Successfully installed pyscreenshot-3.1 pyscreeze-0.1.29
python versioning dependency-management pyautogui
1个回答
0
投票

您当前安装的 pygetwindow 版本是什么?

如果你尝试,结果会怎样:

pip3 install pygetwindow==0.0.5

似乎您当前的 pygetwindow 版本可能与 pyautogui 所需的版本冲突。我建议尝试像 Anaconda 这样的虚拟环境,这样这个项目的库版本就不会与其他项目的版本冲突。

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