pip安装老出错,打包exe文件安装PyInstaller,用安装包安装全解!

我们平时安装python模块库都会使用pip指令,习惯了使用pip指令在线安装,你还会用安装包离线安装吗?

使用pip指令出现了一大串的红色error

pip install pyinstaller

错误文本为

 ERROR: Command errored out with exit status 1:
     command: 'd:\软件聚集地\python\python.exe' 'd:\软件聚集地\python\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\lys\AppData\Local\Temp\tmp_zypq6dl'
         cwd: C:\Users\lys\AppData\Local\Temp\pip-install-xl8kscts\pyinstaller
    Complete output (36 lines):
    running dist_info
    creating C:\Users\lys\AppData\Local\Temp\pip-install-xl8kscts\pyinstaller\pip-wheel-metadata\PyInstaller.egg-info
    writing C:\Users\lys\AppData\Local\Temp\pip-install-xl8kscts\pyinstaller\pip-wheel-metadata\PyInstaller.egg-info\PKG-INFO
    writing dependency_links to C:\Users\lys\AppData\Local\Temp\pip-install-xl8kscts\pyinstaller\pip-wheel-metadata\PyInstaller.egg-info\dependency_links.txt
    writing entry points to C:\Users\lys\AppData\Local\Temp\pip-install-xl8kscts\pyinstaller\pip-wheel-metadata\PyInstaller.egg-info\entry_points.txt
    writing requirements to C:\Users\lys\AppData\Local\Temp\pip-install-xl8kscts\pyinstaller\pip-wheel-metadata\PyInstaller.egg-info\requires.txt
    writing top-level names to C:\Users\lys\AppData\Local\Temp\pip-install-xl8kscts\pyinstaller\pip-wheel-metadata\PyInstaller.egg-info\top_level.txt
    writing manifest file 'C:\Users\lys\AppData\Local\Temp\pip-install-xl8kscts\pyinstaller\pip-wheel-metadata\PyInstaller.egg-info\SOURCES.txt'
    reading manifest file 'C:\Users\lys\AppData\Local\Temp\pip-install-xl8kscts\pyinstaller\pip-wheel-metadata\PyInstaller.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    Error in sitecustomize; set PYTHONVERBOSE for traceback:
    SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xc8 in position 0: invalid continuation byte (sitecustomize.py, line 7)
    no previously-included directories found matching 'bootloader\build'
    no previously-included directories found matching 'bootloader\.waf-*'
    no previously-included directories found matching 'bootloader\.waf3-*'
    no previously-included directories found matching 'bootloader\waf-*'
    no previously-included directories found matching 'bootloader\waf3-*'
    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 'doc\source'
    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 'tests\scripts'
    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\lys\AppData\Local\Temp\pip-install-xl8kscts\pyinstaller\pip-wheel-metadata\PyInstaller.egg-info\SOURCES.txt'
    creating 'C:\Users\lys\AppData\Local\Temp\pip-install-xl8kscts\pyinstaller\pip-wheel-metadata\PyInstaller.dist-info'
    error: invalid command 'bdist_wheel'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'd:\软件聚集地\python\python.exe' 'd:\软件聚集地\python\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\lys\AppData\Local\Temp\tmp_zypq6dl' Check the logs for full command output.

看不清看截图
在这里插入图片描述

遇到这种情况,我们就可以去官网下载安装包了

使用下载地址进行pyinstaller下载,下载pyinstaller.tar.tz压缩包
点击蓝色字体或者访问http://www.pyinstaller.org/downloads.html

找到下图的下载部分,点击箭头所指部分。
在这里插入图片描述
解压缩到当前文件夹
在这里插入图片描述
在这里插入图片描述
接下来执行cmd指令

使用cd指令定位到setup.py的文件夹

以下是示例路径

cd D:\pyinstaller\PyInstaller-3.5
D:

执行python安装指令

python setup.py install

在这里插入图片描述
执行完毕,没有看到红色字体

查询pyinstaller版本

输入指令

pyinstaller -version

在这里插入图片描述
出现上图这样,说明已经成功了

接下来打包自己的文件就可以了

在这里插入图片描述

发布了35 篇原创文章 · 获赞 30 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_43792401/article/details/99353661
今日推荐