pyinstaller打包程序報錯的解決辦法


錯誤一:upx is not available

原因是由於subprocess.py程序被改動過,解決辦法是將其中Popen類的初始化函數的shell參數默認值改為False即可,upx貌似是一種脫殼程序,打包的時候需要用Popen調用upx。

class Popen(object):
    """ Execute a child program in a new process.

    ...

    Attributes:
        stdin, stdout, stderr, pid, returncode
    """
    _child_created = False  # Set here since __del__ checks it

    def __init__(self, args, bufsize=-1, executable=None,
                 stdin=None, stdout=None, stderr=None,
                 preexec_fn=None, close_fds=_PLATFORM_DEFAULT_CLOSE_FDS,
                 shell=False, cwd=None, env=None, universal_newlines=False,
                 startupinfo=None, creationflags=0,
                 restore_signals=True, start_new_session=False,
                 pass_fds=(), *, encoding=None, errors=None):

錯誤二:LINK : fatal error LNK1158: cannot run 'rc.exe'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158

原因是vc安裝目錄下缺少兩個文件,解決辦法就是

從路徑 C:\Program Files (x86)\Windows Kits\8.1\bin\x86復制

rc.exe  rcdll.dll 

兩個文件

到路徑C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM