相关疑难解决方法(0)

使用PyInstaller 2.1和MEIPASS错误捆绑数据文件--onefile

之前已经问过这个问题,我似乎无法使我的PyInstaller正常工作.我在mainscript.py文件中调用了以下代码:

def resource_path(relative_path):
    """ Get absolute path to resource, works for dev and for PyInstaller """
    try:
        # PyInstaller creates a temp folder and stores path in _MEIPASS
        base_path = sys._MEIPASS
    except Exception:
        base_path = os.path.abspath(".")

    return os.path.join(base_path, relative_path)
Run Code Online (Sandbox Code Playgroud)

当我运行py文件(在IDLE中)时,我的应用程序运行完美并加载所有数据文件.但是,当我用PyInstaller 2.1(一种文件方法)捆绑它时,我在exe构建后得到以下错误:

Traceback (most recent call last):
File "<string>", line 37, in <module>
WindowsError: [Error 3] The system cannot find the path   
specified: 'C:\\Users\\Me\\AppData\\Local\\Temp\\_MEI188722\\eggs/*.*'
Run Code Online (Sandbox Code Playgroud)

有谁知道我哪里出错了?谢谢!

**编辑**

这正是我想要做的.

我的主脚本有一个设置(导入),如下所示.基本上我希望能够在其中包含Matplotlib,Basemap和资源路径:

import os,sys
import matplotlib
matplotlib.use('WX')
import wx
from matplotlib.backends.backend_wx import FigureCanvasWx …
Run Code Online (Sandbox Code Playgroud)

python exe build environment-variables pyinstaller

10
推荐指数
1
解决办法
1万
查看次数

标签 统计

build ×1

environment-variables ×1

exe ×1

pyinstaller ×1

python ×1