这是我的代码:
from twilio.rest import Client
# Your Account SID from twilio.com/console
account_sid = "sid"
# Your Auth Token from twilio.com/console
auth_token = "token"
client = Client(account_sid, auth_token)
message = client.messages.create(
to="number",
from_="number",
body="new phone who dis")
print(message.sid)
以下是错误消息:
Traceback (most recent call last):
File "/Users/mahika/Documents/sendtexttest.py", line 1, in <module>
from twilio.rest import Client
File "build/bdist.macosx-10.6-intel/egg/twilio/rest/__init__.py", line 14, in <module>
File "build/bdist.macosx-10.6-intel/egg/twilio/http/http_client.py", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests-2.18.4-py2.7.egg/requests/__init__.py", line 43, in <module>
import urllib3
ImportError: No module named urllib3
问题是urllib3已经安装。我该怎么办?
答案 0 :(得分:0)
好像你没有正确地将urllib3
安装到python解释器路径。
你在评论中给你的python翻译:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
如何找到我的机器上安装urllib3的位置?
如果要查看计算机上安装urllib3
的位置,可以使用此命令查找它:
sudo find / -name urllib3
我建议你检查一下你当前的python解释器中是否安装了urllib3
:
sudo find /Library/Frameworks/Python.framework/Versions/2.7/site-packages -name urllib3
修改强>
如果你想在那里安装它:
/Library/Frameworks/Python.framework/Versions/2.7/bin/pip install urllib3