pyinstaller .exe找不到'dateutil.tz.__init__.tz'

时间:2016-03-09 15:44:01

标签: python-3.x matplotlib kivy pyinstaller

这是我第一次创建.exe(或任何包)。虽然我根据the kivy-manual成功创建了kivy-touchtracer演示的exe文件。
我使用相同的方法从我的kivy-app创建.exe。它假设只在Windows上运行(第一个里程碑)。

非exe版本按我的意愿运行。我可以设法创建一个.exe文件,但不知何故它没有运行。
基本上,程序应该收集一些数据,“计算一下”给定的数据,创建一些图(matplotlib)并创建一个报告 - pdf(reportlab)。

我已经尝试过:

  • 将来自python / Lib / sitepackages / dateutil的dateutils复制到创建的dist目录中。 (由reportlab帮助)
  • 将dateutil / tz / init 中的'from .tz import *'行修改为'from tz import *'(删除点)

他们似乎毫无用处......


我怎么能运行我的exe?我错过了什么? (Matplotlib位于pyinstaller的supported-package列表中。)

操作系统:Win7
Python:3.4

我的cal.spec文件:

class Meta:
        app_label = 'app_name'

结果这是我的.kivy / log.txt:

# -*- mode: python -*-

from kivy.deps import sdl2, glew

block_cipher = None


a = Analysis(['C:\\EZS-2G\\main.py'],
             pathex=['C:\\EZS-2G\\calApp'],
             binaries=None,
             datas=None,
             hiddenimports=['cycler','pyparsing','setuptools','tkinter','PyPDF2','jinja2','sqlite3','markupsafe','PIL','tornado','pytz','dateutil','reportlab','numpy','matplotlib'],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='Cal',
          debug=False,
          strip=False,
          upx=True,
          console=True )
coll = COLLECT(exe, Tree('C:\\EZS-2G\\'),
               a.binaries,
               a.zipfiles,
               a.datas,
               *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
               strip=False,
               upx=True,
               name='Cal')

2 个答案:

答案 0 :(得分:2)

我遇到了同样的问题(也在Windows 7和Python 3.4以及python-dateutil版本2.5上)。我做了一些阅读,例如在https://github.com/dateutil/dateutil/pull/202#issuecomment-192352290。像我一样,我试图对dateutil包进行一些修改,但最后我只是将包恢复到以前版本的pip即'pip install python-dateutil == 2.4.2',这就解决了我的问题。 / p>

答案 1 :(得分:0)

我有类似的问题。既然一切正常,我发现使用以下解决方法:

import warnings

warnings.filterwarnings("ignore", category=UserWarning)