问题描述
再次返回.我仍在努力,但无法解决
back again. I am still working on it but I can not fix it
脚本运行正常,但是当我使用cx_freeze冻结脚本时,会出现cx_freeze错误.
The script is running fine but when I freeze it using cx_freeze a cx_freeze error appears.
说
找不到OSError:proj数据目录.期望它在:C:\ python34 ........ mpl_toolkits \ basemap \ data
OSError:proj data directory not found. Expecting it at: C:\python34........mpl_toolkits\basemap\data
cx_freeze创建的构建目录中是否不包含数据?
Is the data not included in the build directory created by cx_freeze ?
我正在使用以下脚本进行冻结
I am using the following script for freezing
base = None
def find_data_file(pyproj):
if getattr(sys,'XXXXs.exe',False):
datadir = os.path.dirname(sys.aaEjecutable.py)
else:
datadir = os.path.dirname(__file__)
return os.path.join(datadir,pyproj)
if (sys.platform == "win32"):
base = "Win32GUI"
exe = Executable(
script = "Conver.py",
icon = "logo4.ico",
targetName = "XXXXs.exe",
base = base
)
includefiles = ["Logo1.jpg","Logo2R.jpg","Logo2R.jpg","logo4.ico",
(('C:\Python34\Lib\site-packages\mpl_toolkits'),("mpl_toolkits"))]
setup(
name = "Conver",
version = "V3",
description = "conve",
author = "Jose ",
options = {"build_exe": {"include_files":includefiles}},
executables = [exe]
)
我认为这是错误的.我必须包括底图,但我不知道该怎么做
I think that something is wrong whit it. I must include the basemap but I dont't know how to do it
我不能前进.脚本很好,但是我可以在没有python的计算机上使用它
I can not go foward. The script is fine but I can use it in a computer with no python
谢谢
推荐答案
一种无需硬编码即可始终获取底图数据目录的方法
A way to always get the basemap data directory, with out hard coding
import matplotlibfrom mpl_toolkits import basemapbuild_options = dict( include_files = [(basemap.basemap_datadir, 'data')])
import matplotlibfrom mpl_toolkits import basemapbuild_options = dict( include_files = [(basemap.basemap_datadir, 'data')])
这篇关于无法使用matplotlib底图和cx_freeze冻结脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!