Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 无法使用py2exe_Python_Py2exe - Fatal编程技术网

Python 无法使用py2exe

Python 无法使用py2exe,python,py2exe,Python,Py2exe,我尝试了很多方法,但我做的大多数代码(例如打印“f”)都运行良好。我不知道为什么我的代码不能在exe中运行。下面是我得到的错误 from distutils.core import setup import py2exe setup( windows=[{'script': 'hello.py'}], options={ 'py2exe': { 'includes': ['lxml.etree', 'lxml._elem

我尝试了很多方法,但我做的大多数代码(例如打印“f”)都运行良好。我不知道为什么我的代码不能在exe中运行。下面是我得到的错误

from distutils.core import setup
import py2exe

setup(
    windows=[{'script': 'hello.py'}],
    options={
        'py2exe': 
        {
            'includes': ['lxml.etree', 'lxml._elementpath', 'gzip'],
        }
    }
)

错误:我得到hello.exe.log

Traceback (most recent call last):
File "hello.py", line 25, in <module>
File "matplotlib\__init__.pyc", line 765, in <module>
File "matplotlib\__init__.pyc", line 683, in rc_params
File "matplotlib\__init__.pyc", line 599, in matplotlib_fname
File "matplotlib\__init__.pyc", line 246, in wrapper
File "matplotlib\__init__.pyc", line 520, in _get_data_path_cached
File "matplotlib\__init__.pyc", line 516, in _get_data_path
RuntimeError: Could not find the matplotlib data files
Traceback (most recent call last):
File "hello.py", line 25, in <module>
File "matplotlib\__init__.pyc", line 765, in <module>
File "matplotlib\__init__.pyc", line 683, in rc_params
File "matplotlib\__init__.pyc", line 599, in matplotlib_fname
File "matplotlib\__init__.pyc", line 246, in wrapper
File "matplotlib\__init__.pyc", line 520, in _get_data_path_cached
File "matplotlib\__init__.pyc", line 516, in _get_data_path
RuntimeError: Could not find the matplotlib data files

这是py2exe的一个已知问题,请参阅

创建捆绑包时,py2exe要求您指定所需的任何外部文件


如果您正在寻找更自动化的东西,请看一看project(在project中,许多常用的库已经被处理过了—不是通过magic,而是因为作者和贡献者已经注意指定了许多常用python库需要哪些外部文件).

当我不确定实际需要哪一个文件时,如何添加所有这些指定外部文件><对不起,我是python编程的新手@6502@ZhenHui当前位置这个问题没有简单的解决办法。在理想的世界库中,作者将以允许打包软件创建工作包的方式显式指定所有运行时依赖项。pyinstaller目前的解决方案是以另一种方式工作(即让打包软件了解所有库),这在我看来要困难得多:pyinstaller是一种非常好用的软件(大多数情况下都能正常工作),编写和维护它是一场噩梦。Py2exe的解决方案是减轻最终用户的负担。
###### IMPORT STATEMENTS ######################################
import csv
import webbrowser
import heapq
from math import floor
import os
from os.path import basename, splitext
import re
from scipy import *
import string
import sys
from time import sleep
import time
import zipfile

from StringIO import StringIO
from Tkinter import *
import Tkinter as Tk
import lxml.etree as et
import matplotlib.cm as cm
from matplotlib.collections import PatchCollection
from matplotlib.patches import Rectangle, Circle, RegularPolygon
from matplotlib.pyplot import *
import matplotlib.pyplot as pl
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
import numpy as np
from pylab import *
import pylab as pl
import pylab as plot
from scipy.integrate import simps
import tkFileDialog
from tkFont import Font
import tkMessageBox
from scipy import interpolate
import pylab as py
import sys