[英]Errors with Matplotlib when making an executable with Py2exe (Python)
I have a problem when trying to make an executable with a Python application. 尝试使用Python应用程序制作可执行文件时出现问题。
For doing this, I'm using Py2exe with the 2.7 version of Python. 为此,我将Py2exe与2.7版本的Python结合使用。
My application have 3 python scripts -> IHM_monotone_flux_GTC.py which is the one who launch a graphical interface 我的应用程序具有3个python脚本-> IHM_monotone_flux_GTC.py,这是一个启动图形界面的程序
and then 2 others scripts: -> lectureDonnees.py -> main.py 然后是另外2个脚本:->讲者Donnees.py-> main.py
In order to create an executable I made a setup.py file which is surely incomplete: 为了创建可执行文件,我制作了一个setup.py文件,该文件肯定不完整:
from distutils.core import setup import py2exe 从distutils.core导入设置导入py2exe
setup(windows=['IHM_monotone_flux_gtc.py']) 设置程序(窗口= [ 'IHM_monotone_flux_gtc.py'])
Unfortunetaly, it doesn't work and I got this error message: 不幸的是,它不起作用,并且我收到了以下错误消息:
Traceback (most recent call last):
File "IHM_monotone_flux_gtc.py", line 16, in <module>
File "main.pyc", line 22, in <module>
File "matplotlib\__init__.pyc", line 838, in <module>
File "matplotlib\__init__.pyc", line 749, in rc_params
File "matplotlib\__init__.pyc", line 664, in matplotlib_fname
File "matplotlib\__init__.pyc", line 292, in wrapper
File "matplotlib\__init__.pyc", line 585, in _get_data_path_cached
File "matplotlib\__init__.pyc", line 581, in _get_data_path
RuntimeError: Could not find the matplotlib data files
Thanks for any help. 谢谢你的帮助。 (I'm working with Windows XP)
(我正在使用Windows XP)
Cédric. 塞德里克。
You will need to copy the mpl-data folder too. 您还需要复制mpl-data文件夹。 Check this official wiki site http://www.py2exe.org/index.cgi/MatPlotLib
检查此官方Wiki网站http://www.py2exe.org/index.cgi/MatPlotLib
import matplotlib
...
setup(
...
data_files=matplotlib.get_py2exe_datafiles(),
)
You will need something like this in your setup.py for py2exe. 在py2exe的setup.py中,您将需要这样的内容。 hope it helps.
希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.