1

私はしばらくこれに苦労してきました。py2exe と cx_freeze を使用してすべてをパッケージ化しました。私は 32 ビット マシンを使用していますが、すべて正常に動作し、インターフェイスが開き、puLP パッケージ全体がパッケージに正しくコピーされていないことがわかっています。ソルバーが機能しないので、私はこれを知っています。py2exe および cx_freeze によって作成されたパッケージの両方のライブラリ zip 内には、.pyc ファイルのみが含まれており、PuLP には cbc.exe およびソルバーを機能させるその他のファイル タイプがあります。

これを回避する方法はありますか? 実際の PuLP パッケージを library.zip と dist フォルダーにコピーしようとしましたが、うまくいきませんでした。

py2exe に使用したセットアップは次のとおりです。 import sys from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["pulp"], 
                    "icon": "icon.ico",
                    "include_files": ["icon.ico","cbc.exe","cbc-32","cbc-64","cbc-osx-64","CoinMP.dll"]}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(  name = "my_app",
        version = "0.1",
        options = {"build_exe": build_exe_options},
        executables = [Executable("my_app.py", base=base)])

次のエラーを受け取りました。

Exception in Tkinter callback
Traceback (most recent call last):
  File "Tkinter.pyc", line 1470, in __call__
  File "my_app.py", line 796, in <lambda>
  File "my_app.py", line 467, in branchAndBound
  File "pulp\pulp.pyc", line 1619, in solve
AttributeError: 'NoneType' object has no attribute 'actualSolve'

編集 パスを cbc.exe と CoinMP.dll に変更しようとしましたが、実際には機能しませんでした。私はおそらく何かが欠けています。

PuLP パッケージの solvers.py 内で次のように変更しました。

try:
    coinMP_path = config.get("locations", "CoinMPPath").split(', ')
except configparser.Error:
    coinMP_path = ['/Users/al/Desktop/my_app/build/exe.win32-2.7']

try:
    cbc_path = config.get("locations", "CbcPath")
except configparser.Error:
    cbc_path = '/Users/al/Desktop/my_app/build/exe.win32-2.7'

try:
    pulp_cbc_path = config.get("locations", "PulpCbcPath")
except configparser.Error:
    pulp_cbc_path = '/Users/al/Desktop/my_app/build/exe.win32-2.7'

私は何が欠けているか、間違っていますか?

4

0 に答える 0