如何解决“导入错误:没有名为twilio.rest的模块”的问题?

时间:2019-07-10 04:56:29

标签: python twilio

运行代码时,它显示错误

"No module named twilio.rest.

我曾尝试通过pip卸载和安装一些时间。

from twilio.rest import Client

client = Client(account_sid, auth_token)

message = client.messages.create(
                       to="",
                       from_="",
                       body="" )

print(message.sid)

ImportError: No module named twilio.rest

2 个答案:

答案 0 :(得分:0)

请检查您是否为项目设置了正确的解释器,并且该解释器安装了 twilio 库。有时我们的IDE中有多个解释器。

答案 1 :(得分:0)

首先,检查您的 python-pip 版本为 2或3
安装Twilio后
如果您使用 python3 并使用 pip2 安装 Twilio ,则此问题会生成