zoukankan      html  css  js  c++  java
  • Python安装pyinstaller方法,以及将项目生成可执行程序的步骤

    pyinstaller安装方法

    前提:确保计算机安装了Python语言环境,并且正确配置了环境变量。

    方法一:联网在线自动安装

    选择一 Windows OS下进入cmd(命令行窗口) 输入:pip install pyinstaller

    选择二 在Pycharm IDE 终端下 输入:pip install pyinstaller

    我在Pycharm 终端下安装pyinstaller时,遇到这样的安装错误:

    D:pycharm-workspace>pip install pyinstaller
    Collecting pyinstaller
    Using cached https://files.pythonhosted.org/packages/03/32/0e0de593f129bf1d1e77eed562496d154ef4460fd5cecfd78612ef39a0cc/PyInstaller-3.4.tar.gz
    Installing build dependencies ... done
    Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Complete output from command 'd:pythonpython.exe' 'd:pythonlibsite-packagespip\_vendorpep517\_in_process.py' prepare_metadata_for_build_wheel 'C:Users林芝AppDataLocalTemp mpjsdjh2mc':
    ERROR: running dist_info
    creating C:Users林芝AppDataLocalTemppip-install-_cg8f619pyinstallerpip-wheel-metadataPyInstaller.egg-info
    writing C:Users林芝AppDataLocalTemppip-install-_cg8f619pyinstallerpip-wheel-metadataPyInstaller.egg-infoPKG-INFO
    writing dependency_links to C:Users林芝AppDataLocalTemppip-install-_cg8f619pyinstallerpip-wheel-metadataPyInstaller.egg-infodependency_links.txt
    writing entry points to C:Users林芝AppDataLocalTemppip-install-_cg8f619pyinstallerpip-wheel-metadataPyInstaller.egg-infoentry_points.txt
    writing requirements to C:Users林芝AppDataLocalTemppip-install-_cg8f619pyinstallerpip-wheel-metadataPyInstaller.egg-info equires.txt
    writing top-level names to C:Users林芝AppDataLocalTemppip-install-_cg8f619pyinstallerpip-wheel-metadataPyInstaller.egg-info op_level.txt
    writing manifest file 'C:Users林芝AppDataLocalTemppip-install-_cg8f619pyinstallerpip-wheel-metadataPyInstaller.egg-infoSOURCES.txt'
    reading manifest file 'C:Users林芝AppDataLocalTemppip-install-_cg8f619pyinstallerpip-wheel-metadataPyInstaller.egg-infoSOURCES.txt'
    reading manifest template 'MANIFEST.in'
    Error in sitecustomize; set PYTHONVERBOSE for traceback:
    SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xc1 in position 0: invalid start byte (sitecustomize.py, line 21)
    no previously-included directories found matching 'bootloaderuild'
    no previously-included directories found matching 'bootloader.waf-*'
    no previously-included directories found matching 'bootloader.waf3-*'
    no previously-included directories found matching 'bootloaderwaf-*'
    no previously-included directories found matching 'bootloaderwaf3-*'
    no previously-included directories found matching 'bootloader\_sdks'
    no previously-included directories found matching 'bootloader.vagrant'
    warning: no previously-included files found matching 'bootloader.lock-waf*'
    no previously-included directories found matching 'docsource'
    no previously-included directories found matching 'doc\_build'
    warning: no previously-included files matching '*.tmp' found under directory 'doc'
    warning: no files found matching 'news\_template.rst'
    no previously-included directories found matching 'news'
    no previously-included directories found matching 'old'
    no previously-included directories found matching 'scripts'
    no previously-included directories found matching 'testsscripts'
    no previously-included directories found matching '.github'
    warning: no previously-included files found matching '.*'
    warning: no previously-included files found matching '*.yml'
    warning: no previously-included files found matching '*~'
    warning: no previously-included files found matching '.directory'
    writing manifest file 'C:Users林芝AppDataLocalTemppip-install-_cg8f619pyinstallerpip-wheel-metadataPyInstaller.egg-infoSOURCES.txt'
    creating 'C:Users林芝AppDataLocalTemppip-install-_cg8f619pyinstallerpip-wheel-metadataPyInstaller.dist-info'
    error: invalid command 'bdist_wheel'
    ----------------------------------------
    ERROR: Command "'d:pythonpython.exe' 'd:pythonlibsite-packagespip\_vendorpep517\_in_process.py' prepare_metadata_for_build_wheel 'C:Users林芝AppDataLocalTemp mpjsdjh2mc'" failed with error code 1 in C:Users林芝
    AppDataLocalTemppip-install-_cg8f619pyinstaller

    ######################## 终端提示我 命令执行失败,错误代码1  我也不知道这种方法安装失败的原因, 欢迎大家交流讨论#######################

    方法二:自主下载pyinstaller包,进行手动安装

    pyinstaller 的下载地址:http://www.pyinstaller.org/downloads.html

    下载文件后,解压文件。

    我的解压路径是:  D:pythonpyinstaller-pyinstaller-d740524

    windows OS cmd(命令行窗口)进入 解压文件所在的目录。

    cd D:pythonpyinstaller-pyinstaller-d740524

    D:

    输入: python setup.py install

    等待一段时间,pyinstaller就会安装成功

    安装成功后,查看一下pyinstaller的版本信息

    pyinstaller --version

    出现结果如下,证明安装成功!

    Python项目生成可执行程序的步骤

    选择一:Windows OS下进入cmd(命令行窗口) 输入:pyinstaller -F xx.py xxx.py ......

    选择二:在Pycharm IDE 终端下 输入:pyinstaller -F xx.py xxx.py ......

    xx.py 和 xxx.py 是要打包的文件名

    -F参数的含义是,将多个.py脚本文件打包成为一个可执行程序。

  • 相关阅读:
    puremvc 入门与思考
    PureMVC QA:Where Should I Declare Notification Name Constants
    PureMVC QA:Why can't Proxies hear Notifications?
    EPUB CFI 规范
    Flex中添加大量组件时内存占用问题
    保垒机SSH登录脚本
    用JAVA给JSON进行排版
    基于ProGuard-Maven-Plugin的自定义代码混淆插件
    Protostuff自定义序列化(Delegate)解析
    Web服务图片压缩,nginx+lua生成缩略图
  • 原文地址:https://www.cnblogs.com/Lints/p/10950716.html
Copyright © 2011-2022 走看看