发现问题

(python3.7) D:\Desktop\文件夹\Oriental_Fortune_Hot_Post\newwork\data\000725-002045>pyinstaller -F OFHP.py
Fatal error in launcher: Unable to create process using '"e:\anaconda3\envs\tf2.0\python.exe"  "E:\Anaconda3\envs\python3.7\Scripts\pyinstaller.exe" -F OFHP.py': ???????????

报错原因

这里报错说的是两个虚拟环境tf2.0python3.7冲突的问题。
博主之前将自己的一个虚拟环境tf2.0改成了python3.7,但是在装pyinstaller包的时候环境名称还是tf2.0,所以我想应该是更改虚拟环境名称的问题,所以最简单的方法就是把这个包删掉重装,结果果然成功了!

操作演示

# 删除旧的安装包
(python3.7) D:\Desktop\文件夹\Oriental_Fortune_Hot_Post\newwork\data\000725-002045>pip uninstall pyinstaller
Found existing installation: pyinstaller 4.2
Uninstalling pyinstaller-4.2:
  Would remove:
    e:\anaconda3\envs\python3.7\lib\site-packages\pyinstaller-4.2.dist-info\*
    e:\anaconda3\envs\python3.7\lib\site-packages\pyinstaller\*
    e:\anaconda3\envs\python3.7\scripts\pyi-archive_viewer.exe
    e:\anaconda3\envs\python3.7\scripts\pyi-bindepend.exe
    e:\anaconda3\envs\python3.7\scripts\pyi-grab_version.exe
    e:\anaconda3\envs\python3.7\scripts\pyi-makespec.exe
    e:\anaconda3\envs\python3.7\scripts\pyi-set_version.exe
    e:\anaconda3\envs\python3.7\scripts\pyinstaller.exe
Proceed (y/n)? y
  Successfully uninstalled pyinstaller-4.2
# 下载新的安装包
(python3.7) D:\Desktop\文件夹\Oriental_Fortune_Hot_Post\newwork\data\000725-002045>pip install pyinstaller
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pyinstaller
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/b6/27/a006fcadba0db30819c968eb8decb4937cda398ca7a44d8874172cdc228a/pyinstaller-4.3.tar.gz (3.7 MB)
     |████████████████████████████████| 3.7 MB 726 kB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: setuptools in e:\anaconda3\envs\python3.7\lib\site-packages (from pyinstaller) (46.0.0.post20200309)
Requirement already satisfied: pywin32-ctypes>=0.2.0; sys_platform == "win32" in e:\anaconda3\envs\python3.7\lib\site-packages (from pyinstaller) (0.2.0)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in e:\anaconda3\envs\python3.7\lib\site-packages (from pyinstaller) (1.7.0)
Requirement already satisfied: altgraph in e:\anaconda3\envs\python3.7\lib\site-packages (from pyinstaller) (0.17)
Requirement already satisfied: pefile>=2017.8.1; sys_platform == "win32" in e:\anaconda3\envs\python3.7\lib\site-packages (from pyinstaller) (2019.4.18)
Requirement already satisfied: pyinstaller-hooks-contrib>=2020.6 in e:\anaconda3\envs\python3.7\lib\site-packages (from pyinstaller) (2020.11)
Requirement already satisfied: zipp>=0.5 in e:\anaconda3\envs\python3.7\lib\site-packages (from importlib-metadata; python_version < "3.8"->pyinstaller) (3.1.0)
Requirement already satisfied: future in e:\anaconda3\envs\python3.7\lib\site-packages (from pefile>=2017.8.1; sys_platform == "win32"->pyinstaller) (0.18.2)
Building wheels for collected packages: pyinstaller
  Building wheel for pyinstaller (PEP 517) ... done
  Created wheel for pyinstaller: filename=pyinstaller-4.3-py3-none-any.whl size=2457297 sha256=681ff5e695fb1703f13703b0ed4df8854cd2090ddc11840df1db91633b51fc86
  Stored in directory: c:\users\administrator\appdata\local\pip\cache\wheels\57\04\db\819b14987d2963bddae9092b3345df29263dd675c6d0387b29
Successfully built pyinstaller
Installing collected packages: pyinstaller
Successfully installed pyinstaller-4.3
# 运行成功
(python3.7) D:\Desktop\文件夹\Oriental_Fortune_Hot_Post\newwork\data\000725-002045>pyinstaller -F OFHP.py
942 INFO: PyInstaller: 4.3
942 INFO: Python: 3.7.6 (conda)
945 INFO: Platform: Windows-10-10.0.18362-SP0
952 INFO: wrote D:\Desktop\文件夹\Oriental_Fortune_Hot_Post\newwork\data\000725-002045\OFHP.spec
957 INFO: UPX is not available.
960 INFO: Extending PYTHONPATH with paths
['D:\\Desktop\\文件夹\\Oriental_Fortune_Hot_Post\\newwork\\data\\000725-002045',
 'D:\\Desktop\\文件夹\\Oriental_Fortune_Hot_Post\\newwork\\data\\000725-002045']
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐