不兼容的库版本:libwx_osx_cocoau_xrc-3.0.dylib需要版本48.0.0或更高版本,但libpng16.16.dylib提供版本38.0.0

时间:2017-09-07 16:33:40

标签: python wxpython wxwidgets pyinstaller libpng

当我使用Y[X == [1,2]] = 1时,我遇到了这个问题,这是一个将python控制台程序转换为GUI应用程序的扩展。我按照这里的说明进行操作:https://github.com/chriskiehl/Gooey,编写代码并使用Gooey将其构建到可执行文件中。我的代码和PyInstaller文件如下:

build.spec
import os
from openpyxl import Workbook
from codecs import open as open_by_encoding
from gooey import Gooey, GooeyParser

@Gooey(language='english', default_size=(850, 350), program_name='Csv2Excel')
def transform():
    parser = GooeyParser(description="Csv2Excel")
    parser.add_argument('Filename', widget='FileChooser', help='Choose Input File')
    parser.add_argument('OutFile', widget='DirChooser', help='Choose Output Dir')
    args = parser.parse_args()
    input_csv = args.Filename
    output_excel = args.OutFile
    csv_filename, ext = os.path.splitext(os.path.basename(input_csv))
    output_excel = os.path.join(output_excel, '%s.xlsx' % csv_filename)
    workbook = Workbook()
    worksheet = workbook.get_sheet_by_name(workbook.get_sheet_names()[0])
    print 'parsing csv to excel...' % output_excel
    with open_by_encoding(input_csv, 'r', 'utf-8') as buf:
        for line in buf:
            worksheet.append([unicode(x) for x in line.strip().split(',')])
    print 'saving excel...' % output_excel
    workbook.save(output_excel)
    print 'successfully!'

但是当我尝试从命令行运行它时:

import gooey
gooey_root = os.path.dirname(gooey.__file__)
gooey_languages = Tree(os.path.join(gooey_root, 'languages'), prefix = 'gooey/languages')
gooey_images = Tree(os.path.join(gooey_root, 'images'), prefix = 'gooey/images')
a = Analysis(['csv2excel/csv2excel.py'],
             pathex=['/Users/wei.chensh/Desktop/csv2excel'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          gooey_languages,
          gooey_images,
          name='csv2excel',
          debug=False,
          strip=False,
          upx=True,
          console=False,
          icon=os.path.join(gooey_root, 'images', 'program_icon.ico'))
app = BUNDLE(exe,
             name='csv2excel.app',
             icon=None,
             bundle_identifier=None)

它提出了以下✔ ~/Desktop/csv2excel/dist 23:52 $ ./csv2excel

ImportError

似乎Traceback (most recent call last): File "csv2excel/csv2excel.py", line 6, in <module> File "/private/var/folders/mh/9q630wzd6hz8m_dlc9l37q300000gn/T/pip-build-GziXtU/pyinstaller/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module File "gooey/__init__.py", line 2, in <module> File "/private/var/folders/mh/9q630wzd6hz8m_dlc9l37q300000gn/T/pip-build-GziXtU/pyinstaller/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module File "gooey/python_bindings/gooey_decorator.py", line 14, in <module> File "/private/var/folders/mh/9q630wzd6hz8m_dlc9l37q300000gn/T/pip-build-GziXtU/pyinstaller/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module File "gooey/gui/application.py", line 5, in <module> File "/private/var/folders/mh/9q630wzd6hz8m_dlc9l37q300000gn/T/pip-build-GziXtU/pyinstaller/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module File "wx-3.0-osx_cocoa/wx/__init__.py", line 45, in <module> File "/private/var/folders/mh/9q630wzd6hz8m_dlc9l37q300000gn/T/pip-build-GziXtU/pyinstaller/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module File "wx-3.0-osx_cocoa/wx/_core.py", line 4, in <module> File "/private/var/folders/mh/9q630wzd6hz8m_dlc9l37q300000gn/T/pip-build-GziXtU/pyinstaller/PyInstaller/loader/pyimod03_importers.py", line 546, in load_module ImportError: dlopen(/var/folders/mh/9q630wzd6hz8m_dlc9l37q300000gn/T/_MEINoVZlj/wx._core_.so, 2): Library not loaded: @loader_path/libpng16.16.dylib Referenced from: /var/folders/mh/9q630wzd6hz8m_dlc9l37q300000gn/T/_MEINoVZlj/libwx_osx_cocoau_xrc-3.0.dylib Reason: Incompatible library version: libwx_osx_cocoau_xrc-3.0.dylib requires version 48.0.0 or later, but libpng16.16.dylib provides version 38.0.0 Failed to execute script csv2excel 版本太旧而无法支持libpng。所以我按照了一些Google搜索说明并将wx升级为libpng但却失败了。看起来homebrew是最新发布的版本。我也根据类似问题的建议进行了一些试验,但是徒劳无功。

B.T.W

我正在使用OS X El Capitan 10.11.6和Python 2.7.10

0 个答案:

没有答案