前提・実現したいこと
pyautoguiをimportしているpyファイルを実行したい。
環境
Mac OS Catalina 10.15.7
発生している問題・エラーメッセージ
pyautoguiをimportしているpyファイルを実行すると下記のエラーが表示されます。
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/rubicon/objc/ctypes_patch.py:21: UserWarning: rubicon.objc.ctypes_patch has only been tested with Python 3.4 through 3.9. You are using Python 3.10.0. Most likely things will work properly, but you may experience crashes if Python's internals have changed significantly. warnings.warn( Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyautogui/_pyautogui_osx.py", line 5, in <module> import Quartz File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Quartz/__init__.py", line 6, in <module> import AppKit File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/AppKit/__init__.py", line 10, in <module> import Foundation File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Foundation/__init__.py", line 9, in <module> import CoreFoundation File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/CoreFoundation/__init__.py", line 9, in <module> import objc File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/objc/__init__.py", line 6, in <module> from . import _objc TypeError: 'objc_meta_class' object is not iterable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/yamashitashinichirou/korian_export/item_updateStatus.py", line 23, in <module> import pyautogui File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyautogui/__init__.py", line 544, in <module> from . import _pyautogui_osx as platformModule File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyautogui/_pyautogui_osx.py", line 7, in <module> assert False, "You must first install pyobjc-core and pyobjc: https://pyautogui.readthedocs.io/en/latest/install.html" AssertionError: You must first install pyobjc-core and pyobjc: https://pyautogui.readthedocs.io/en/latest/install.html
pyobjc-core とpyobjcはインストール済みなのですが「You must first install pyobjc-core and pyobjc」という文言が表示されています。
エラー文上部に「You are using Python 3.10.0. 」と記載されているので、
pyenv versionコマンドで確認したところ
3.6.9でした。
どのような理由なのか皆目検討つかず、ヒントでも構いませんのでご教授お願いできれば幸いです。
エラーメッセージによると3.10で実行されていますね。
> pyenv versionコマンドで確認したところ3.6.9でした。
その環境でそのままコードを実行すれば良さそうですが出来ないのでしょうか?
which python
where python
which python3
where python3
echo $PATH
あたりの結果を載せてみてはどうでしょう
コメントありがとうございます。
@meg_
そのまま実行したのですが、上記のエラーになりました。
@quickquip
確認した結果以下のようになりました。
$which python
/usr/bin/python
$where python
/usr/bin/python
$which python3
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3
$where python3
/usr/local/bin/python3
/usr/bin/python3
echo $PATH
/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
上記の結果からすると「pyenv global 3.6.9」というコマンドを実行すればpythonバージョン3.6.9で実行しているという理解だったのですが、そうではないということになるのでしょうか?理解できていない箇所含めご教授いただければ幸いです。
情報はこの欄に書くのではなく、質問を編集しましょう。
回答3件
あなたの回答
tips
プレビュー