aks.py:
from twilio.rest import Client
执行上述代码时,出现错误:
Traceback (most recent call last):
File "aks.py", line 10, in <module>
from twilio.rest import Client
File "/usr/local/lib/python2.7/dist-packages/twilio/rest/__init__.py", line 14, in <module>
from twilio.http.http_client import TwilioHttpClient
File "/usr/local/lib/python2.7/dist-packages/twilio/http/http_client.py", line 1, in <module>
from requests import Request, Session, hooks
File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line 63, in <module>
from . import utils
File "/usr/lib/python2.7/dist-packages/requests/utils.py", line 24, in <module>
from ._internal_utils import to_native_string
File "/usr/lib/python2.7/dist-packages/requests/_internal_utils.py", line 11, in <module>
from .compat import is_py2, builtin_str, str
File "/usr/lib/python2.7/dist-packages/requests/compat.py", line 46, in <module>
from .packages.urllib3.packages.ordered_dict import OrderedDict
ImportError: No module named ordered_dict
我尝试了各种操作,例如将Urllib降级为1.23,取消安装,重新安装twilio和sudo -H pip2.7 install twilio
答案 0 :(得分:0)
我通过制作一个python 3虚拟环境解决了它,并且可以正常工作。 我认为由于某些原因,twilio在python 2.7上无法正常工作
答案 1 :(得分:0)
我的项目依赖项之一“ google-endpoints ”,取决于“ Google Endpoints API Management ”,该依赖项取决于请求,而请求则取决于urllib3,但是该帖子请求不支持已安装的 urllib3 == 1.24 。
可以通过安装以前的稳定版本urllib3解决此问题:
pip install urllib3==1.23
答案 2 :(得分:0)
INSTALLED_APPS = [ 'django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles','orders','products', 'profiles', ]
我有同样的问题。请检查已安装的应用程序中的设置。天气您的应用程序位于设置部分