的Python:LookupError:未知编码:十六进制 [英] Python: LookupError: unknown encoding: hex

查看:711
本文介绍了的Python:LookupError:未知编码:十六进制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Twitter的API叫做Tweepy。据工作正常,然后我重新启动服务器,现在我得到这样的:

I'm using a Twitter API called Tweepy. It has been working fine, then I rebooted the server and now I'm getting this:

>>> import tweepy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "tweepy/__init__.py", line 17, in <module>
    from tweepy.streaming import Stream, StreamListener
  File "tweepy/streaming.py", line 16, in <module>
    json = import_simplejson()
  File "tweepy/utils.py", line 83, in import_simplejson
    import simplejson as json
  File "build/bdist.linux-i686/egg/simplejson/__init__.py", line 111, in <module>

  File "build/bdist.linux-i686/egg/simplejson/decoder.py", line 29, in <module>
  File "build/bdist.linux-i686/egg/simplejson/decoder.py", line 21, in _floatconstants
LookupError: unknown encoding: hex

我想这太:

from encodings import hex_codec

和它并没有帮助。

任何想法,为什么?

推荐答案

我已经经历了同样的问题(使用JSON),解决的办法是复制丢失hex_ codec.py'文件在你的'编码lib文件夹:

I've been experiencing the same problem (with json), the solution is to copy missing 'hex_codec.py' file at your 'encodings' Lib folder:

请确保你已经安装了Python 2.7.X(以后有用,你会发现它)。

Make sure you have Python 2.7.X installed (you'll find it useful later).


  1. 转到了编码文件夹你的Python 2.7.X的安装目录(如适用于Win平台:C:\\ Python27 \\ LIB \\编码')

  2. 复制hex_ codec.py'或每一个的.py文件到您的构建/ bdist.linux-的i686 /蛋/编码文件夹。
    ...

  3. 利润

这篇关于的Python:LookupError:未知编码:十六进制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆