pyinstaller的Python-pyinstaller-executable项目出现错误,无法执行脚本pyi_rth_pkges

pyinstaller的Python-pyinstaller-executable项目出现错误,无法执行脚本pyi_rth_pkges,python,python-3.x,selenium,pyinstaller,Python,Python 3.x,Selenium,Pyinstaller,我试图通过pyinstaller执行项目,但在运行程序后执行脚本pyi_rth_pkges时出错 大家好,这是项目结构:tree/F app-1.0.1 这是setup.py代码: 在使用代码:pyinstaller-onefile-w setup.py之后,我在Shell中看到了消息 我得到'dist'文件夹有Setup.exe,但从sheel运行后,我看到此错误 从文件夹中的Setup.exe运行后,我看到以下消息错误: 您应该在主文件代码中添加此导入 导入pkg_resources.py2

我试图通过pyinstaller执行项目,但在运行程序后执行脚本pyi_rth_pkges时出错

大家好,这是项目结构:tree/F app-1.0.1

这是setup.py代码:

在使用代码:pyinstaller-onefile-w setup.py之后,我在Shell中看到了消息

我得到'dist'文件夹有Setup.exe,但从sheel运行后,我看到此错误

从文件夹中的Setup.exe运行后,我看到以下消息错误:


您应该在主文件代码中添加此导入

导入pkg_resources.py2_警告

此外,您可以键入此项以尝试解决问题

pip卸载pyinstaller

pip安装https://github.com/pyinstaller/pyinstaller/archive/develop.zip


编译setup.py是毫无意义的。它不会影响python的安装。PyInstaller有自己独立的内部环境,可以安装它。当您以单文件模式运行时,已安装的软件包将被删除。你不能编辑一个文件的可执行文件。哦,我不知道为什么python在可执行应用程序中会有这些问题,但如果在Microsoft Visual Studio中构建它,你的应用程序很容易执行。我用tkinter和脚本selenium构建了我的应用程序树,我如何构建可执行的应用程序。如果可以在Visual Studio中移动此项目selenium并通过它构建GUI和可执行应用程序而不出现任何问题,那么您就错了。你想构建一个类似pypi的库,还是一个类似FileZilla的程序?我需要构建一个类似FileZilla的程序。但是不用安装就可以运行和使用它。这很简单。运行应用程序时运行的主要python文件是哪一个?我在main.py中添加了这一行,但同样的问题是,我认为这种方式setuptools iby pyinstaller是错误的pkg_资源不是问题所在。是的,但是@john正在编译错误的anks AhmedHaies,在main.py中添加import pkg_resources.py2_warn并删除setup.py后,所有这些都可以正常工作
│   LICENSE
│   main.py      # this module to run GUI build by tkinter
│   MANIFEST.in
│   PKG-INFO
│   README.md
│   setup.cfg
│   setup.py      # this is the module to package all application
│
├───app.egg-info
│       dependency_links.txt
│       entry_points.txt
│       PKG-INFO
│       requires.txt
│       SOURCES.txt
│       top_level.txt
│
├───components
│       frame.py 
│       menu.py
│       vie.py
│       __init__.py
│
├───lib
│       functions.py
│       variable.py
│       __init__.py
│
├───pages
│       winAbout.py
│       win_star.py
│       __init__.py
│
├───data
    │   __init__.py
    │
    └───image
            logo.ico
            home.jpg
            __init__.py
from setuptools import setup , find_packages

setup(
    name="app",
    version="1.0.1",
    description="A Python package to get Auto reports for any Site.",
    author="john",
    author_email="john@gmail.com",
    license="MIT",
    classifiers=[
        "License :: OSI Approved :: MIT License",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.7",
    ],
    packages=find_packages(),
    package_data={
        'data': ['image/*.ico', 'image/*.jpg'],
    },
    install_requires= ['Pillow'],
    entry_points={
        'console_scripts': [
            'napp=main:App'
        ]
    }
)
1699 INFO: PyInstaller: 3.6
1699 INFO: Python: 3.8.2
1715 INFO: Platform: Windows-10-10.0.18362-SP0
1715 INFO: wrote C:\Users\JOHN\Desktop\app\setup.spec
1730 INFO: UPX is not available.
1768 INFO: Extending PYTHONPATH with paths
['C:\\Users\\JOHN\\Desktop\\app', 'C:\\Users\\JOHN\\Desktop\\app']
1768 INFO: checking Analysis
1768 INFO: Building Analysis because Analysis-00.toc is non existent
1768 INFO: Initializing module dependency graph...
1784 INFO: Caching module graph hooks...
1815 INFO: Analyzing base_library.zip ...
11684 INFO: Processing pre-find module path hook   distutils
11690 INFO: distutils: retargeting to non-venv dir 'c:\\python\\lib'
24084 INFO: Caching module dependency graph...
24348 INFO: running Analysis Analysis-00.toc
24448 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\python\python.exe
24702 INFO: Analyzing C:\Users\JOHN\Desktop\Amazon\setup.py
25809 INFO: Processing pre-find module path hook   site
25840 INFO: site: retargeting to fake-dir 'c:\\python\\lib\\site-packages\\PyInstaller\\fake-modules'
32617 INFO: Processing pre-safe import module hook   setuptools.extern.six.moves
34642 INFO: Processing module hooks...
34642 INFO: Loading module hook "hook-distutils.py"...
34695 INFO: Loading module hook "hook-encodings.py"...
34858 INFO: Loading module hook "hook-lib2to3.py"...
34958 INFO: Loading module hook "hook-pkg_resources.py"...
36349 INFO: Processing pre-safe import module hook   win32com
36581 INFO: Excluding import '__main__'
36581 INFO:   Removing import of __main__ from module pkg_resources
36581 INFO: Loading module hook "hook-pycparser.py"...
36618 INFO: Loading module hook "hook-pydoc.py"...
36618 INFO: Loading module hook "hook-pythoncom.py"...
37182 INFO: Loading module hook "hook-pywintypes.py"...
37745 INFO: Loading module hook "hook-setuptools.py"...
39108 INFO: Loading module hook "hook-sysconfig.py"...
39126 INFO: Loading module hook "hook-win32com.py"...
c:\python\lib\site-packages\win32com\client\makepy.py:369: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if path is not '' and not os.path.exists(path):
40488 INFO: Loading module hook "hook-xml.dom.domreg.py"...
40519 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
40519 INFO: Loading module hook "hook-xml.py"...
40519 INFO: Loading module hook "hook-_tkinter.py"...
41461 INFO: checking Tree
41461 INFO: Building Tree because Tree-00.toc is non existent
41461 INFO: Building Tree Tree-00.toc
41923 INFO: checking Tree
41923 INFO: Building Tree because Tree-01.toc is non existent
41923 INFO: Building Tree Tree-01.toc
42005 INFO: Looking for ctypes DLLs
42121 INFO: Analyzing run-time hooks ...
42121 INFO: Including run-time hook 'pyi_rth__tkinter.py'
42158 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
42205 INFO: Including run-time hook 'pyi_rth_pkgres.py'
42220 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
42289 INFO: Looking for dynamic libraries
44434 INFO: Looking for eggs
44434 INFO: Using Python library c:\python\python38.dll
44434 INFO: Found binding redirects:
[]
44465 INFO: Warnings written to C:\Users\JOHN\Desktop\app\build\setup\warn-setup.txt
44614 INFO: Graph cross-reference written to C:\Users\JOHN\Desktop\app\build\setup\xref-setup.html
44773 INFO: checking PYZ
44773 INFO: Building PYZ because PYZ-00.toc is non existent
44773 INFO: Building PYZ (ZlibArchive) C:\Users\JOHN\Desktop\app\build\setup\PYZ-00.pyz
46679 INFO: Building PYZ (ZlibArchive) C:\Users\JOHN\Desktop\app\build\setup\PYZ-00.pyz completed successfully.
46759 INFO: checking PKG
46759 INFO: Building PKG because PKG-00.toc is non existent
46759 INFO: Building PKG (CArchive) PKG-00.pkg
66169 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
66215 INFO: Bootloader c:\python\lib\site-packages\PyInstaller\bootloader\Windows-32bit\runw.exe
66215 INFO: checking EXE
66215 INFO: Building EXE because EXE-00.toc is non existent
66231 INFO: Building EXE from EXE-00.toc
66247 INFO: Appending archive to EXE C:\Users\JOHN\Desktop\app\dist\setup.exe
66331 INFO: Building EXE from EXE-00.toc completed successfully.
PS C:\Users\JOHN\Desktop\app\dist> Setup.exe
Setup.exe : The term 'Setup.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Setup.exe
+ ~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Setup.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


Suggestion [3,General]: The command Setup.exe was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\Setup.exe". See "get-help about_Command_Precedence" for more details.