• Python3.6安装pyinstaller


    很久之前装了python可是最近需要把xxx.py打包成xxx.exe,然后找了教程试了也无果,各种失败

    首先在cmd下输入:python -m pip install PyWin32

    然后在官网下载pyinstaller,下载前先看自己的python是32bit还是64bit:

    python

    在官网下载对应版本,解压,重命名(根据个人爱好)然后移动到python目录下:

    打开cmd,进入刚刚复制的文件夹的目录,执行:python setup.py install

    然后进入pyinstaller-pyinstaller文件夹下的script文件夹:

    复制这个路径到环境变量

    如果过程中出现未注册的提示信息复制以下代码运行后在安装

    import sys
    
    from winreg import *
    
    # tweak as necessary
    version = sys.version[:3]
    installpath = sys.prefix
    
    regpath = "SOFTWARE\Python\Pythoncore\%s\" % (version)
    installkey = "InstallPath"
    pythonkey = "PythonPath"
    pythonpath = "%s;%s\Lib\;%s\DLLs\" % (
        installpath, installpath, installpath
    )
    
    
    def RegisterPy():
        try:
            reg = OpenKey(HKEY_CURRENT_USER, regpath)
        except EnvironmentError as e:
            try:
                reg = CreateKey(HKEY_CURRENT_USER, regpath)
                SetValue(reg, installkey, REG_SZ, installpath)
                SetValue(reg, pythonkey, REG_SZ, pythonpath)
                CloseKey(reg)
            except:
                print("*** Unable to register!")
                return
            print("--- Python", version, "is now registered!")
            return
        if (QueryValue(reg, installkey) == installpath and
                    QueryValue(reg, pythonkey) == pythonpath):
            CloseKey(reg)
            print("=== Python", version, "is already registered!")
            return
        CloseKey(reg)
        print("*** Unable to register!")
        print("*** You probably have another Python installation!")
    
    
    if __name__ == "__main__":
        RegisterPy()
  • 相关阅读:
    设计模式学习笔记之一:策略模式
    向上转型和向下转型
    html readonly和disabled的区别
    如何自定义JSR-303标准的validator
    vue 组件属性props,特性驼峰命名,连接线使用
    laydate中设置动态改变max与min值的方法
    浅谈JS中 reduce() 的用法
    jq 实时监听input输入框的变化
    npm install --save 和 npm install -d的区别
    vue中html、js、vue文件之间的简单引用与关系
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13302380.html
Copyright © 2020-2023  润新知