Cx_freeze问题,用于将.py文件转换为.exe文件

时间:2017-06-28 13:31:06

标签: pyqt cx-freeze

我正在尝试使用以下流程开发应用程序:

  1. 使用Qt 5.6.2在Qt Designer中制作的GUI
  2. 使用pyuic5
  3. 将GUI文件(扩展名.ui)转换为py
  4. 在Spyder中传输代码并在最近转换的.py文件中添加一些循环。 注意:代码在spyder 3.1.4中工作正常,没有错误。 gui出现并充分发挥了必要的功能。
  5. 使用cx.freeze 5.0.2编译

    4.1创建setup.py文件,如下所示(但也尝试了互联网上的其他版本):

    来自cx_Freeze导入设置,可执行文件

    设置(名称=" vsc.py",       version =" 0.1" ,       description ="" ,       executables = [可执行文件(" vsc.py")])

    4.2在cmd:python setup.py build中运行(使用正确的目录,同时在同一目录下使用vsc.py和setup.py文件)

    4.3构建包含大量文件的文件夹(包括vsc.exe),但这个没有运行。

  6. 我为步骤4.2得到的错误:

    缺少模块:

    use strict;
    use warnings;
    
    my $input = 'FILENAME.csv';
    my $output = 'FILENAME.txt';
    
    open (INPUT, "<", "$input_file") or die "\n !! Cannot open $input_file: $!";
    open (OUTPUT, ">>", "$output_file") or die "\n !! Cannot create $output_file: $!";
    
    while ( <INPUT> ) {
    
        my $line = $_;
        $line =~ s/\s*$//g;
    
        my ( $a, $b, $c, $d, $e, $f, $g, $h, $i, $j ) = split('\,', $line);
    
        $a = sprintf '%10s', $a;
        $b = sprintf '%10s', $b;
        $c = sprintf '%10s', $c;
        $d = sprintf '%10s', $d;
        $e = sprintf '%10s', $e;
        $f = sprintf '%10s', $f;
        $g = sprintf '%10s', $g;
        $h = sprintf '%10s', $h;
        $i = sprintf '%10s', $i;
        $j = sprintf '%10s', $j;
    
        print OUTPUT "$a$b$c$d$e$f$g$h$i$j\n";
    
    }
    
    close INPUT;
    close OUTPUT;
    
    exit;
    

    问题: 有人有过这种问题吗?你知道PyQt5编译需要哪些缺少的模块吗?例如,IronPython不适用于python 3.6。除了py2exe之外还有其他编译方法吗?

    非常感谢你!

    编辑:
    运行.exe文件时收到的错误消息:

    ? IronPython.Runtime.Exceptions imported from nose.suite
    ? StringIO imported from numpy.lib.utils, numpy.testing.utils
    ? __builtin__ imported from numpy, numpy.core.numeric, numpy.core.numerictypes,
    numpy.distutils.misc_util, numpy.lib._iotools, numpy.lib.function_base, numpy.ma
    .core
    ? __main__ imported from bdb, pdb, rlcompleter
    ? _curses imported from curses, curses.has_key
    ? _dummy_threading imported from dummy_threading
    ? _frozen_importlib imported from importlib, importlib.abc
    ? _frozen_importlib_external imported from importlib, importlib._bootstrap, impo
    rtlib.abc
    ? _posixsubprocess imported from multiprocessing.util, subprocess
    ? _scproxy imported from urllib.request
    ? _winreg imported from numpy.distutils.cpuinfo, platform
    ? anaconda_decrypt imported from site
    ? cPickle imported from numpy.core.numeric, numpy.lib.npyio, numpy.ma.core
    ? clr imported from nose.suite
    ? commands imported from numpy.distutils.cpuinfo
    ? compiler.consts imported from nose.pyversion
    ? copy_reg imported from numpy.core
    ? future_builtins imported from numpy.lib.npyio
    ? grp imported from distutils.archive_util, pathlib, shutil, tarfile
    ? java.lang imported from platform
    ? multiprocessing.AuthenticationError imported from multiprocessing.connection
    ? multiprocessing.BufferTooShort imported from multiprocessing.connection
    ? multiprocessing.Manager imported from nose.plugins.plugintest
    ? multiprocessing.SimpleQueue imported from concurrent.futures.process
    ? multiprocessing.TimeoutError imported from multiprocessing.pool
    ? multiprocessing.current_process imported from nose.plugins.plugintest
    ? multiprocessing.get_context imported from multiprocessing.managers, multiproce
    ssing.pool, multiprocessing.sharedctypes
    ? multiprocessing.get_start_method imported from multiprocessing.spawn
    ? multiprocessing.set_start_method imported from multiprocessing.spawn
    ? new imported from nose.ext.dtcompat, nose.pyversion
    ? numarray imported from numpy.distutils.system_info
    ? numpy.core.float32 imported from numpy.testing.utils
    ? numpy.core.geterrobj imported from numpy.linalg.linalg
    ? numpy.core.integer imported from numpy.fft.helper
    ? numpy.core.intp imported from numpy.linalg.linalg
    ? numpy.core.longdouble imported from numpy.linalg.linalg
    ? numpy.core.object_ imported from numpy.linalg.linalg
    ? numpy.core.signbit imported from numpy.testing.utils
    ? numpy_distutils imported from numpy.f2py.diagnose
    ? numpy_distutils.command.build_flib imported from numpy.f2py.diagnose
    ? numpy_distutils.command.cpuinfo imported from numpy.f2py.diagnose
    ? numpy_distutils.cpuinfo imported from numpy.f2py.diagnose
    ? numpy_distutils.fcompiler imported from numpy.f2py.diagnose
    ? org.python.core imported from copy, pickle
    ? os.path imported from distutils.file_util, numpy.core.memmap, os, pkgutil, py_
    compile, sysconfig, tracemalloc, unittest, unittest.util
    ? pkg_resources imported from nose.plugins.manager
    ? posix imported from os
    ? pwd imported from distutils.archive_util, distutils.util, getpass, http.server
    , netrc, pathlib, posixpath, shutil, tarfile, webbrowser
    ? scipy imported from numpy.testing.nosetester
    ? sets imported from nose.util, numpy.distutils.command.build_ext, numpy.distuti
    ls.fcompiler, numpy.distutils.misc_util
    ? setuptools imported from numpy.distutils.core
    ? setuptools.command imported from numpy.distutils.core
    ? setuptools.command.bdist_rpm imported from numpy.distutils.command.bdist_rpm
    ? setuptools.command.develop imported from numpy.distutils.command.develop
    ? setuptools.command.egg_info imported from numpy.distutils.command.egg_info
    ? setuptools.command.install imported from numpy.distutils.command.install
    ? setuptools.command.sdist imported from numpy.distutils.command.sdist
    ? termios imported from getpass, tty
    ? unittest2.case imported from nose.plugins.skip
    ? urllib2 imported from numpy.lib._datasource
    ? urlparse imported from numpy.lib._datasource
    ? vms_lib imported from platform
    This is not necessarily a problem - the modules may not be needed on this platfo
    rm.
    
    Copying data from package PyQt5...
    copying C:\Users\aa82758\Anaconda3\lib\site-packages\PyQt5\QtCore.pyd -> build\e
    xe.win-amd64-3.6\PyQt5\QtCore.pyd
    copying C:\Users\aa82758\Anaconda3\Library\bin\Qt5Core.dll -> build\exe.win-amd6
    4-3.6\Qt5Core.dll
    copying C:\Users\aa82758\Anaconda3\Library\bin\zlib.dll -> build\exe.win-amd64-3
    .6\zlib.dll
    copying C:\Users\aa82758\Anaconda3\Library\bin\icuin57.dll -> build\exe.win-amd6
    4-3.6\icuin57.dll
    copying C:\Users\aa82758\Anaconda3\Library\bin\icuuc57.dll -> build\exe.win-amd6
    4-3.6\icuuc57.dll
    copying C:\Users\aa82758\Anaconda3\Library\bin\icudt57.dll -> build\exe.win-amd6
    4-3.6\icudt57.dll
    copying C:\Users\aa82758\Anaconda3\Library\bin\api-ms-win-crt-utility-l1-1-0.dll
     -> build\exe.win-amd64-3.6\api-ms-win-crt-utility-l1-1-0.dll
    copying C:\Users\aa82758\Anaconda3\Library\bin\MSVCP140.dll -> build\exe.win-amd
    64-3.6\MSVCP140.dll
    copying C:\Users\aa82758\Anaconda3\lib\site-packages\PyQt5\QtGui.pyd -> build\ex
    e.win-amd64-3.6\PyQt5\QtGui.pyd
    copying C:\Users\aa82758\Anaconda3\Library\bin\Qt5Gui.dll -> build\exe.win-amd64
    -3.6\Qt5Gui.dll
    copying C:\Users\aa82758\Anaconda3\Library\bin\libpng16.dll -> build\exe.win-amd
    64-3.6\libpng16.dll
    copying C:\Users\aa82758\Anaconda3\lib\site-packages\PyQt5\QtWidgets.pyd -> buil
    d\exe.win-amd64-3.6\PyQt5\QtWidgets.pyd
    copying C:\Users\aa82758\Anaconda3\Library\bin\Qt5Widgets.dll -> build\exe.win-a
    md64-3.6\Qt5Widgets.dll
    Copying data from package collections...
    Copying data from package concurrent...
    Copying data from package ctypes...
    Copying data from package curses...
    Copying data from package distutils...
    Copying data from package email...
    Copying data from package encodings...
    Copying data from package html...
    Copying data from package http...
    Copying data from package importlib...
    Copying data from package json...
    Copying data from package lib2to3...
    Copying data from package logging...
    Copying data from package multiprocessing...
    Copying data from package nose...
    Copying data from package numpy...
    copying C:\Users\aa82758\Anaconda3\lib\site-packages\numpy\core\multiarray.cp36-
    win_amd64.pyd -> build\exe.win-amd64-3.6\numpy\core\multiarray.cp36-win_amd64.py
    d
    copying C:\Users\aa82758\Anaconda3\lib\site-packages\numpy\core\umath.cp36-win_a
    md64.pyd -> build\exe.win-amd64-3.6\numpy\core\umath.cp36-win_amd64.pyd
    copying C:\Users\aa82758\Anaconda3\lib\site-packages\numpy\fft\fftpack_lite.cp36
    -win_amd64.pyd -> build\exe.win-amd64-3.6\numpy\fft\fftpack_lite.cp36-win_amd64.
    pyd
    copying C:\Users\aa82758\Anaconda3\lib\site-packages\numpy\linalg\lapack_lite.cp
    36-win_amd64.pyd -> build\exe.win-amd64-3.6\numpy\linalg\lapack_lite.cp36-win_am
    d64.pyd
    copying C:\Users\aa82758\Anaconda3\lib\site-packages\numpy\random\mtrand.cp36-wi
    n_amd64.pyd -> build\exe.win-amd64-3.6\numpy\random\mtrand.cp36-win_amd64.pyd
    Copying data from package pydoc_data...
    Copying data from package scipy...
    Copying data from package unittest...
    Copying data from package urllib...
    Copying data from package xml...
    Copying data from package xmlrpc...
    copying C:\Users\aa82758\Anaconda3\DLLs\_bz2.pyd -> build\exe.win-amd64-3.6\_bz2
    .pyd
    copying C:\Users\aa82758\Anaconda3\DLLs\_ctypes.pyd -> build\exe.win-amd64-3.6\_
    ctypes.pyd
    copying C:\Users\aa82758\Anaconda3\DLLs\_decimal.pyd -> build\exe.win-amd64-3.6\
    _decimal.pyd
    copying C:\Users\aa82758\Anaconda3\DLLs\_hashlib.pyd -> build\exe.win-amd64-3.6\
    _hashlib.pyd
    copying C:\Users\aa82758\Anaconda3\DLLs\_lzma.pyd -> build\exe.win-amd64-3.6\_lz
    ma.pyd
    copying C:\Users\aa82758\Anaconda3\DLLs\_multiprocessing.pyd -> build\exe.win-am
    d64-3.6\_multiprocessing.pyd
    copying C:\Users\aa82758\Anaconda3\DLLs\_socket.pyd -> build\exe.win-amd64-3.6\_
    socket.pyd
    copying C:\Users\aa82758\Anaconda3\DLLs\_ssl.pyd -> build\exe.win-amd64-3.6\_ssl
    .pyd
    copying C:\Users\aa82758\Anaconda3\lib\site-packages\win32\_win32sysloader.pyd -
    > build\exe.win-amd64-3.6\_win32sysloader.pyd
    copying C:\Users\aa82758\Anaconda3\DLLs\pyexpat.pyd -> build\exe.win-amd64-3.6\p
    yexpat.pyd
    copying C:\Users\aa82758\Anaconda3\DLLs\select.pyd -> build\exe.win-amd64-3.6\se
    lect.pyd
    copying C:\Users\aa82758\Anaconda3\lib\site-packages\sip.pyd -> build\exe.win-am
    d64-3.6\sip.pyd
    copying C:\Users\aa82758\Anaconda3\DLLs\unicodedata.pyd -> build\exe.win-amd64-3
    .6\unicodedata.pyd
    copying C:\Users\aa82758\Anaconda3\lib\site-packages\win32\win32api.pyd -> build
    \exe.win-amd64-3.6\win32api.pyd
    copying C:\Users\aa82758\Anaconda3\lib\site-packages\win32\pywintypes36.dll -> b
    uild\exe.win-amd64-3.6\pywintypes36.dll
    copying C:\Users\aa82758\Anaconda3\lib\site-packages\win32\win32evtlog.pyd -> bu
    ild\exe.win-amd64-3.6\win32evtlog.pyd
    copying C:\Users\aa82758\Anaconda3\lib\site-packages\win32\win32pdh.pyd -> build
    \exe.win-amd64-3.6\win32pdh.pyd
    

0 个答案:

没有答案