这个简单的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'
我尝试过的:
请告诉我如何解决此类错误。
% 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