Dav*_*han 4 python importerror twilio
关于twilio-python,我遇到了与此主题相同的问题:
twilio python模块版本2.0.8中缺少twilio.rest?
但是我有同样的问题,但我安装了3.3.3.在尝试导入twilio.rest时,我仍然得到"没有名为rest的模块".
从独立的python脚本加载库工作.所以我知道安装包的pip工作.
from twilio.rest import TwilioRestClient
def main():
account = "xxxxxxxxxxxxxxxx"
token = "xxxxxxxxxxxxxxxx"
client = TwilioRestClient(account, token)
call = client.calls.create(to="+12223344",
from_="+12223344",
url="http://ironblanket.herokuapp.com/",
method="GET")
if __name__ == "__main__":
main()
Run Code Online (Sandbox Code Playgroud)
但这不起作用:
from twilio.rest import TwilioRestClient
def home(request):
client = TwilioRestClient(account, token)
Run Code Online (Sandbox Code Playgroud)
你知道我接下来可以尝试什么吗?
Dav*_*han 14
我在我的项目中命名了一个python文件twilio.py.由于该文件首先被加载,然后加载twilio的后续调用将引用该文件而不是twilio库.
TLDR:只是不要将你的python文件命名为twilio.py
| 归档时间: |
|
| 查看次数: |
8090 次 |
| 最近记录: |