1
from twilio.rest import Client
# Your Account SID from twilio.com/console
account_sid = "`enter code here`"
# Your Auth Token from twilio.com/console
auth_token = "`enter code here`"
client = Client(account_sid, auth_token)
message = client.messages.create(
to="`enter code here`",
from_="`enter code here`",
body="Hello from Python!")
print(message.sid)
錯誤彈出:我使用twilio 6.0.2和客戶端不能正常工作
Traceback (most recent call last): File "C:\Users\mediamarkt2\AppData\Local\Programs\Python\Python36-32\sendtext.py", line 1, in from twilio.rest import Client ImportError: cannot import name 'Client'
我使用的是6.0。我究竟做錯了什麼?
是什麼讓你相信twilio安裝在你的Python中? – lit
正如@lit也暗示着,如果你在終端輸入'pip list',你會看到twilio(6.X.X)嗎? – Andy
當我導入twilio並打印出來(twilio .__ version__)沒有錯誤 –