cx_freeze と py2exe を使用して、python 3 で記述されたプログラムを .exe に変換しようとしていました。しかし、プログラムを変換して実行した後、次のエラーが発生します。
Traceback (most recent call last):
File "astroConverter.py", line 8, in <module>
File "C:\Users\Konrad\PycharmProjects\astroConverter\mainwindow.py", line 2, in <module>
from widgets.widgets import MainMenu, Toolbar, TextField
File "C:\Users\Konrad\PycharmProjects\astroConverter\widgets\widgets.py", line 1, in <module>
from widgets.menus import FileMenu, EditMenu, HelpMenu
File "C:\Users\Konrad\PycharmProjects\astroConverter\widgets\menus.py", line 2, in <module>
from common import Info
File "C:\Users\Konrad\PycharmProjects\astroConverter\common.py", line 2, in <module>
from astropy.io import fits
File "C:\Python34\lib\site-packages\astropy\__init__.py", line 73, in <module>
_check_numpy()
File "C:\Python34\lib\site-packages\astropy\__init__.py", line 61, in _check_numpy
from .utils import minversion
File "C:\Python34\lib\site-packages\astropy\utils\__init__.py", line 15, in <module>
from .codegen import *
File "C:\Python34\lib\site-packages\astropy\utils\codegen.py", line 15, in <module>
from .introspection import find_current_module
File "C:\Python34\lib\site-packages\astropy\utils\introspection.py", line 14, in <module>
from ..extern import six
File "C:\Python34\lib\site-packages\astropy\extern\six.py", line 60, in <module>
_import_six()
File "C:\Python34\lib\site-packages\astropy\extern\six.py", line 57, in _import_six
"distribution.".format(_SIX_MIN_VERSION))
ImportError: Astropy requires the 'six' module of minimum version 1.7.3; normally this is bundled wi
th the astropy package so if you get this warning consult the packager of your Astropy distribution.
これは私の cx_freeze setup.py スクリプトです:
import sys
from cx_Freeze import setup, Executable
buildExeOptions = {"packages": ["astropy", "numpy", "matplotlib"],
"includes": ["six"],
"silent": ["-s"]}
base = None
if sys.platform == 'win32':
base = 'Win32GUI'
setup(name='astroConverter',
version="0.4",
description="Format converter used in astronomy",
options={"build_exe": buildExeOptions},
executables=[Executable("astroConverter.py", base=base)]
)
および py2exe スクリプト:
from distutils.core import setup
import py2exe
setup(console=['astroConverter.py'])
の出力は次のpip freeze
とおりです。
C:\WINDOWS\system32>pip freeze
astropy==1.0.1
cx-Freeze==4.3.4
matplotlib==1.4.3
numpy==1.9.2
py2exe==0.9.2.2
pyparsing==2.0.3
python-dateutil==2.4.1
pytz==2015.2
six==1.9.0
UNKNOWN==0.0.0
virtualenv==13.1.0
ご覧のとおり、私のsix
モジュールは astropy で必要なバージョンよりも新しいバージョンです。奇妙なことに、すべてのパッケージが適切にインストールされており、実行中はすべて正常に動作しますpython astroConverter.py
。これは GUI アプリケーションです (tkinter を使用しています)。cx_freeze または py2exe に「six」モジュールを適切に含める方法を知っている人はいますか?