Python 2.7中的TwilioRestClient出错

Python 2.7中的TwilioRestClient出错,python,twilio,Python,Twilio,我最近安装了Twilio模块,我正在使用Python 2.7 Credentials.py--> account_sid = "AXXXXXXXXXXXXXXXXXXXXXXXXXXXXx" auth_token = "978XXXXXXXXXXXXXXXXXXXXXX" my_phone = "+XXXXXXXXXXXX" my_twilio = "+XXXXXXXXXXXX" from twilio.rest import TwilioRestClient from credent

我最近安装了Twilio模块,我正在使用Python 2.7

Credentials.py-->

account_sid = "AXXXXXXXXXXXXXXXXXXXXXXXXXXXXx"

auth_token = "978XXXXXXXXXXXXXXXXXXXXXX"

my_phone = "+XXXXXXXXXXXX"

my_twilio = "+XXXXXXXXXXXX"
from twilio.rest import TwilioRestClient

from credentials import account_sid, auth_token, my_phone, my_twilio

client = TwilioRestClient(account_sid, auth_token)

message = 'Hello Sarthak, How are you?'

final_message = client.messages.create(to=my_phone, from_=my_twilio, 
body=message)
message.py----->

account_sid = "AXXXXXXXXXXXXXXXXXXXXXXXXXXXXx"

auth_token = "978XXXXXXXXXXXXXXXXXXXXXX"

my_phone = "+XXXXXXXXXXXX"

my_twilio = "+XXXXXXXXXXXX"
from twilio.rest import TwilioRestClient

from credentials import account_sid, auth_token, my_phone, my_twilio

client = TwilioRestClient(account_sid, auth_token)

message = 'Hello Sarthak, How are you?'

final_message = client.messages.create(to=my_phone, from_=my_twilio, 
body=message)
当我尝试运行此操作时,出现以下错误:-


TwilioRestClient已弃用。您必须导入客户端。确保您也在使用Python 3。

当我尝试导入客户端时,它说未定义的引用意味着无法在twilio中找到客户端。rest,我使用的是Python 2.7,我需要使用3.x吗?我不熟悉旧版本的Twilio支持,但这听起来是个好主意。尝试在Python3环境中运行它。