python – Py2exe,带有tweepy的Runtimeerror
作者:互联网
我想使用twitter的python插件叫做tweepy.
在我的main.py文件中,我刚刚导入了tweepy
import tweepy
我的setup文件如下所示:
from distutils.core import setup
import py2exe
setup(
windows=[{
"script": 'main.py',
}],
options={
"py2exe": {
"includes": ["sip", "tweepy"]
}
}
)
当我通过命令行执行python setupy.py py2exe时,我得到了这个重复的代码块,直到我得到一个RuntimeError:相比之下超出了最大递归深度.
File "C:\Python34\lib\site-packages\py2exe\hooks.py", line 291, in __getattr__
self.__finder.safe_import_hook(renamed, caller=self)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 138, in safe_import_hook
self.import_hook(name, caller, fromlist, level)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 120, in import_hook
module = self._gcd_import(name)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 274, in _gcd_import
return self._find_and_load(name)
File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 298, in _find_and_load
getattr(parent_module, name.rpartition('.')[2])
有谁知道摆脱这个循环的方法?
解决方法:
07.2在py2exe的0.9.2.2版本中,模块six.moves.urllib.parse进入无限递归循环,直到达到最大深度.
如果你真的不需要这个模块,解决它的一种方法是在setup.py中排除模块:
options={
"py2exe": {
"includes": ["sip", "tweepy"],
"excludes": ["six.moves.urllib.parse"]
}
}
标签:py2exe,python,tweepy 来源: https://codeday.me/bug/20190927/1824477.html