我刚刚注册了一个Twilio帐户,我用pip安装了它。我正在运行python 3.10。我只是想给自己发个短信。
我的代码:
from twilio.rest import Client
client = Client('my twilio account SID', 'my twilio auth token')
message = client.messages \
.create(
body="Join Earth's mightiest heroes. Like Kevin Bacon.",
from_='my twilio phone number',
to='my personal phone number'
)
print(message.sid)
我得到以下错误:
ModuleNotFoundError: No module named 'twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping'
不知道这里出了什么问题。我基本上遵循了Twilio教程到T。
发布于 2022-10-24 23:22:13
这是因为我没有使用pip完全安装Twilio软件包。在再次运行这个程序以确保我已经真正安装了所有东西之后:
pip install twilio
我受到一个错误的欢迎
Could not install packages due to an OSError: [Errno 2] No such file or directory
搜索此错误后,会发现被访问的路径非常长(>250个字符)。我必须按照我找到的这个简单的指南来启用它:
https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/
https://stackoverflow.com/questions/74187519
复制相似问题