Mac Mini M1下运行Google Calendar API示例脚本报错,虚拟环境调用系统Python路径的疑问求助
Mac Mini M1下运行Google Calendar API示例脚本报错,虚拟环境调用系统Python路径的疑问求助
我用的是Mac Mini M1,最近在尝试配置Google Calendar API,已经跟着官方文档的每一步操作了。
但是运行提供的示例脚本quickstart.py时,出现了如下错误:
Traceback (most recent call last): File "/Users/matt/bin/scripts/calendar/quickstart.py", line 70, in <module> main() File "/Users/matt/bin/scripts/calendar/quickstart.py", line 32, in main creds = flow.run_local_server(0) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/matt/bin/scripts/calendar/lib/python3.11/site-packages/google_auth_oauthlib/flow.py", line 432, in run_local_server local_server = wsgiref.simple_server.make_server( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/wsgiref/simple_server.py", line 154, in make_server server = server_class((host, port), handler_class) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py", line 456, in __init__ self.server_bind() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/wsgiref/simple_server.py", line 50, in server_bind HTTPServer.server_bind(self) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/server.py", line 136, in server_bind socketserver.TCPServer.server_bind(self) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py", line 472, in server_bind self.socket.bind(self.server_address) TypeError: str, bytes or bytearray expected, not int
让我搞不懂的是,明明我已经在虚拟环境(路径是/Users/matt/bin/scripts/calendar)里运行脚本,为什么相关库会去调用系统级的Python路径(/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11)呢?
我已经检查过是否有冲突的shell别名了,确认没有问题。
有没有朋友遇到过类似的情况?或者能给我一些排查的思路吗?
谢谢大家!
备注:内容来源于stack exchange,提问作者coolmatt
相关产品推荐
相关产品推荐

