使python 2.7 tkinter gui成为可执行文件

时间:2015-01-19 19:07:30

标签: python pandas tkinter py2exe cx-freeze

我试图从我的Tkinter gui.py。

创建一个可执行文件

我搜索了解决方案,我找到了py2exe和cx_freeze。

他们两个都给了我同样的错误:

---------------------------
cx_Freeze: Python error in main script
---------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module>
exec(code, m.__dict__)
File "C:\Users\omris\PycharmProjects\tools\ctrlC_gui.py", line 12, in <module>
import excel_zeros_mail as ezm
File "C:\Users\omris\PycharmProjects\tools\excel_zeros_mail.py", line 3, in <module>
import pandas as pd
  File "C:\Python27\lib\site-packages\pandas\__init__.py", line 53, in <module>
    from pandas.io.api import *
  File "C:\Python27\lib\site-packages\pandas\io\api.py", line 15, in <module>
    from pandas.io.gbq import read_gbq
  File "C:\Python27\lib\site-packages\pandas\io\gbq.py", line 44, in <module>
    _GOOGLE_API_CLIENT_VERSION = pkg_resources.get_distribution('google-api-python-client').version
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 332, in get_distribution
    dist = get_provider(dist)
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 212, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 741, in require
    needed = self.resolve(parse_requirements(requirements))
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 626, in resolve
    raise DistributionNotFound(req)
DistributionNotFound: google-api-python-client

---------------------------
OK   
---------------------------

这是我的setup.py代码:

from distutils.core import setup
import py2exe

setup(console=["analyst_gui.py"])

我在一个非常简单的tkinter gui上进行了测试,效果很好。

我的猜测是否与pandas导入有关?

这是我在tkinter gui中的导入:

   import threading
   from Tkinter import *
   import tkMessageBox
   from ttk import *
   import pyperclip
   import time
   from tkFileDialog import *
   import pandas as pd

我去了代码处理问题,该问题位于pkg_resources.py:

if dist is None:
       #msg = ("The '%s' distribution was not found on this "
       #       "system, and is required by this application.")
       #raise DistributionNotFound(msg % req)
       # unfortunately, zc.buildout uses a str(err)
       # to get the name of the distribution here..
       raise DistributionNotFound(req)

我无法找出问题所在

我的google-api-python-client版本是1.3.1

我的熊猫版本是0.15.2

0 个答案:

没有答案