【发布时间】:2012-02-11 20:40:36
【问题描述】:
关于twilio-python,我遇到了与此线程相同的问题:
twilio.rest missing from twilio python module version 2.0.8?
但是我有同样的问题,但我安装了 3.3.3。尝试导入 twilio.rest 时,我仍然收到“No module named 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()
但这不起作用:
from twilio.rest import TwilioRestClient
def home(request):
client = TwilioRestClient(account, token)
你知道我接下来可以尝试什么吗?
【问题讨论】:
-
您可能正在使用不同版本的 python 运行这两个脚本。尝试使用
/usr/bin/env python <filename>运行第二个脚本。 -
我遇到了同样的问题。当我导航到
usr/bin/时,我看到我安装了 Python2.5、2.6 和 2.7。如何将我的默认值更新为 Python2.7?
标签: python importerror twilio