忘天z 发表于 2020-9-13 23:35:31

我用pycharm安装pyinstaller失败了,求大佬帮助

我在pycharm的setting里面下载安装了pyinstaller,然后在terminal里面输入,结果显示错误,哪位大佬教教我该怎么做,我想打包py文件成exe
D:\Users\zengfanchao\PycharmProjects>pyinstaller
Traceback (most recent call last):
File "C:\Program Files\Python38\lib\site-packages\pkg_resources\__init__.py", line 584, in _build_master
    ws.require(__requires__)
File "C:\Program Files\Python38\lib\site-packages\pkg_resources\__init__.py", line 901, in require
    needed = self.resolve(parse_requirements(requirements))
File "C:\Program Files\Python38\lib\site-packages\pkg_resources\__init__.py", line 792, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (pyinstaller 4.0 (c:\users\zengfanchao\appdata\roaming\python\python38\site-packages), Requirement.parse('PyInstaller==3.4'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Program Files\Python38\Scripts\pyinstaller-script.py", line 6, in <module>
    from pkg_resources import load_entry_point
File "C:\Program Files\Python38\lib\site-packages\pkg_resources\__init__.py", line 3262, in <module>
    def _initialize_master_working_set():
File "C:\Program Files\Python38\lib\site-packages\pkg_resources\__init__.py", line 3245, in _call_aside
    f(*args, **kwargs)
File "C:\Program Files\Python38\lib\site-packages\pkg_resources\__init__.py", line 3274, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
File "C:\Program Files\Python38\lib\site-packages\pkg_resources\__init__.py", line 586, in _build_master
    return cls._build_from_requirements(__requires__)
D:\Users\zengfanchao\PycharmProjects>


lirenbing01 发表于 2020-9-14 09:35:45

本帖最后由 lirenbing01 于 2020-9-14 09:39 编辑

# 安装pyinstaller3.4试试
pip install pyinstaller==3.4
# 打包
pyinstallerxx.py

忘天z 发表于 2020-9-14 14:20:39

lirenbing01 发表于 2020-9-14 09:35


改了之后有效,但是打包的时候好像遇到问题了
"C:\Program Files\Python38\Scripts\pyinstaller.exe" -F test.py
53 INFO: PyInstaller: 3.4
53 INFO: Python: 3.8.4rc1
53 INFO: Platform: Windows-10-10.0.18362-SP0
54 INFO: wrote D:\Users\zengfanchao\PycharmProjects\untitled\test.spec
54 INFO: UPX is not available.
55 INFO: Extending PYTHONPATH with paths
['D:\\Users\\zengfanchao\\PycharmProjects\\untitled',
'D:\\Users\\zengfanchao\\PycharmProjects\\untitled']
55 INFO: checking Analysis
58 INFO: Building because pathex changed
58 INFO: Initializing module dependency graph...
60 INFO: Initializing module graph hooks...
61 INFO: Analyzing base_library.zip ...
1900 INFO: Processing pre-find module path hook   distutils
4421 INFO: running Analysis Analysis-00.toc
4423 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by C:\Program Files\Python38\python.exe
4692 INFO: Caching module hooks...
4696 INFO: Analyzing D:\Users\zengfanchao\PycharmProjects\untitled\test.py
4701 INFO: Loading module hooks...
4701 INFO: Loading module hook "hook-distutils.py"...
4702 INFO: Loading module hook "hook-encodings.py"...
4774 INFO: Loading module hook "hook-lib2to3.py"...
4779 INFO: Loading module hook "hook-pydoc.py"...
4779 INFO: Loading module hook "hook-sysconfig.py"...
4780 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
4780 INFO: Loading module hook "hook-xml.py"...
4823 INFO: Loading module hook "hook-_tkinter.py"...
4941 INFO: checking Tree
4941 INFO: Building Tree because Tree-00.toc is non existent
4941 INFO: Building Tree Tree-00.toc
5023 INFO: checking Tree
5023 INFO: Building Tree because Tree-01.toc is non existent
5024 INFO: Building Tree Tree-01.toc
5049 INFO: Looking for ctypes DLLs
5077 INFO: Analyzing run-time hooks ...
5081 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
5086 INFO: Including run-time hook 'pyi_rth__tkinter.py'
5092 INFO: Looking for dynamic libraries
5297 INFO: Looking for eggs
5297 INFO: Using Python library C:\Program Files\Python38\python38.dll
5297 INFO: Found binding redirects:
[]
5303 INFO: Warnings written to D:\Users\zengfanchao\PycharmProjects\untitled\build\test\warn-test.txt
5348 INFO: Graph cross-reference written to D:\Users\zengfanchao\PycharmProjects\untitled\build\test\xref-test.html
5389 INFO: checking PYZ
5390 INFO: Building PYZ because PYZ-00.toc is non existent
5390 INFO: Building PYZ (ZlibArchive) D:\Users\zengfanchao\PycharmProjects\untitled\build\test\PYZ-00.pyz
Traceback (most recent call last):
File "C:\Program Files\Python38\Scripts\pyinstaller-script.py", line 11, in <module>
    load_entry_point('PyInstaller==3.4', 'console_scripts', 'pyinstaller')()
File "c:\program files\python38\lib\site-packages\pyinstaller-3.4-py3.8.egg\PyInstaller\__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
File "c:\program files\python38\lib\site-packages\pyinstaller-3.4-py3.8.egg\PyInstaller\__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\program files\python38\lib\site-packages\pyinstaller-3.4-py3.8.egg\PyInstaller\building\build_main.py", line 838, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\program files\python38\lib\site-packages\pyinstaller-3.4-py3.8.egg\PyInstaller\building\build_main.py", line 784, in build
    exec(text, spec_namespace)
File "<string>", line 18, in <module>
File "c:\program files\python38\lib\site-packages\pyinstaller-3.4-py3.8.egg\PyInstaller\building\api.py", line 98, in __init__
    self.__postinit__()
File "c:\program files\python38\lib\site-packages\pyinstaller-3.4-py3.8.egg\PyInstaller\building\datastruct.py", line 158, in __postinit__
    self.assemble()
File "c:\program files\python38\lib\site-packages\pyinstaller-3.4-py3.8.egg\PyInstaller\building\api.py", line 128, in assemble
    self.code_dict = {
File "c:\program files\python38\lib\site-packages\pyinstaller-3.4-py3.8.egg\PyInstaller\building\api.py", line 129, in <dictcomp>
    key: strip_paths_in_code(code)
File "c:\program files\python38\lib\site-packages\pyinstaller-3.4-py3.8.egg\PyInstaller\building\utils.py", line 654, in strip_paths_in_code
    consts = tuple(
File "c:\program files\python38\lib\site-packages\pyinstaller-3.4-py3.8.egg\PyInstaller\building\utils.py", line 655, in <genexpr>
    strip_paths_in_code(const_co, new_filename)
File "c:\program files\python38\lib\site-packages\pyinstaller-3.4-py3.8.egg\PyInstaller\building\utils.py", line 654, in strip_paths_in_code
    consts = tuple(
File "c:\program files\python38\lib\site-packages\pyinstaller-3.4-py3.8.egg\PyInstaller\building\utils.py", line 655, in <genexpr>
    strip_paths_in_code(const_co, new_filename)
File "c:\program files\python38\lib\site-packages\pyinstaller-3.4-py3.8.egg\PyInstaller\building\utils.py", line 662, in strip_paths_in_code
    return code_func(co.co_argcount, co.co_kwonlyargcount, co.co_nlocals, co.co_stacksize,
TypeError: an integer is required (got type bytes)

lirenbing01 发表于 2020-9-14 15:11:55

忘天z 发表于 2020-9-14 14:20
改了之后有效,但是打包的时候好像遇到问题了
"C:\Program Files\Python38\Scripts\pyinstaller.exe" -F ...

那估计是python3.8版本问题 你用虚拟环境弄个3.7版本的打包吧
页: [1]
查看完整版本: 我用pycharm安装pyinstaller失败了,求大佬帮助