Pyinstaller给了我一个无法运行的exe

2024-04-26 22:06:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我想使用pyinstaller将py代码转换为exe。我在Ubuntu上做的,效果很好。现在我想在windows上构建我的应用程序,但pyinstaller为我创建了一个无法运行的.exe文件,更好的是,它会在我启动时崩溃,因此尝试打开一个立即关闭的窗口。我试着建立一个简单的“Hello world”,它很有效。我不知道为什么它不工作,这是我的规格文件

# -*- mode: python ; coding: utf-8 -*-
from kivy_deps import sdl2, glew, gstreamer

block_cipher = None


a = Analysis(['YouTube2mp3.py'], 
             pathex=['C:\\Users\\samto\\Documenti'],
             binaries=[],
             datas=[('ffmpeg.exe', 'ffmpeg.exe')],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz, Tree('C:\\Users\\samto\\Documenti'),
          a.scripts,
          [],
          exclude_binaries=True,
          name='YouTube2mp3',
          debug=False,
          bootloader_ignore_signals=False,
          *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins + gstreamer.dep_bins)],
          strip=False,
          upx=True,
          console=True )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               upx_exclude=[],
               name='YouTube2mp3')

这是我的密码:

from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
from kivy.uix.popup import Popup


from pydub import AudioSegment
from pytube import YouTube
import os
import threading

class YouTube2mp3App(App):
    
        
    def build(self):

        self.mylayout = FloatLayout()
        mylabel = Label(text= "Benvenuto su YouTube2mp3!\nInserisci il link e premi converti", size_hint=(.8,.2),pos_hint={"x":.1, "y":.7}, font_size=20)
        self.txt = TextInput(hint_text="Incolla qui",size_hint=(.9,.1), pos_hint={"x":.05, "y":.4})
        self.pb = Label(text="", size_hint=(.9,.2), pos_hint={"x":.05, "y":.1}, font_size=20)
        mybutton =Button(text="Nuovo/i video", on_press= self.clearText,size_hint=(.45,.1), pos_hint={"x":.5, "y":.3})  
        mybutton2 =Button(text="Converti", on_press= self.callback,size_hint=(.45,.1), pos_hint={"x":.05, "y":.3}) 
        self.mylayout.add_widget(mylabel)
        self.mylayout.add_widget(self.txt)
        self.mylayout.add_widget(self.pb)
        self.mylayout.add_widget(mybutton)
        self.mylayout.add_widget(mybutton2)
        return self.mylayout

    def clearText(self, instance):
        #clear input
        self.txt.text = ''

    def callback(self, instance):
        self.pb.text="Convertendo..."
        self.t = threading.Thread(target = self.convert)
        self.t.start()

    def convert(self):
        #try:

        #starting to convert using 3 methods    
            ns=self.check_spazio(self.txt.text)

            
            links=self.list_of_links(ns)
            
            
            self.Tube(links)
            content = Button(text='Chiudi', size_hint=(.3,.7))
            popup = Popup(title="Fatto!", content=content, auto_dismiss=False, size_hint=(.3,.2))
            
            content.bind(on_press=popup.dismiss)
            popup.open()
            self.pb.text=""
#       except:
#           content = Button(text='Chiudi', size_hint=(.3,.7))
#           popup = Popup(title="Link non valido", content=content, auto_dismiss=False, size_hint=(.3,.2))
#           content.bind(on_press=popup.dismiss)
#           popup.open()
#           self.pb.text=""

    def Tube(self, lista):
        #convert
        #AudioSegment.convert = r"C:\\Users\\samto\\Documents\\ffmepg\\bin\\ffmpeg.exe"
        for text in lista:
            yt=YouTube(text)
            ys=yt.streams.get_audio_only()

            file=ys.download()
            ya=file[:-1]+"3"
            AudioSegment.from_file(file).export(ya, format="mp3")
            os.remove(file)

    def check_spazio(self, string):
        #check space between input string 
        s=list(string)
        strig=[]
        for i in s:
            if i!=" ":
                strig.append(i) 
        string = "".join(strig)
        return string

    def list_of_links(self, string):
        #create a list of strings. Each string is a link
        prev=0
        links=[]
        for i in range (len(string)):
            if string[i]=="\n" or string[i]==",":
                links.append(string[prev:i])
                prev=i+1
            elif i==len(string)-1:
                links.append(string[prev:i+1])
        return links

if __name__ == '__main__':
    a=True
    YouTube2mp3App().run()
    while a==True:
        pass

当我按照kivy文档的要求构建规范文件时,我会得到以下结果:

C:\Users\samto\Documenti>python -m PyInstaller YouTube2mp3.spec
141 INFO: PyInstaller: 4.0
141 INFO: Python: 3.7.0
142 INFO: Platform: Windows-10-10.0.18362-SP0
148 INFO: UPX is not available.
163 INFO: Extending PYTHONPATH with paths
['C:\\Users\\samto\\Documenti']
393 INFO: checking Analysis
453 INFO: Building because pathex changed
453 INFO: Initializing module dependency graph...
460 INFO: Caching module graph hooks...
510 INFO: Analyzing base_library.zip ...
10864 INFO: Caching module dependency graph...
11095 INFO: running Analysis Analysis-00.toc
11139 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by C:\Users\samto\AppData\Local\Programs\Python\Python37\python.exe
11334 INFO: Analyzing YouTube2mp3.py
14552 INFO: Processing pre-find module path hook distutils from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
14556 INFO: distutils: retargeting to non-venv dir 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib'
20025 INFO: Processing module hooks...
20026 INFO: Loading module hook 'hook-distutils.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks'...
20032 INFO: Loading module hook 'hook-encodings.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks'...
20228 INFO: Loading module hook 'hook-kivy.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks'...
[INFO   ] [Logger      ] Record log in C:\Users\samto\.kivy\logs\kivy_20-09-07_23.txt
20296 INFO: [Logger      ] Record log in C:\Users\samto\.kivy\logs\kivy_20-09-07_23.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.gstreamer" 0.1.18
20291 INFO: [deps        ] Successfully imported "kivy_deps.gstreamer" 0.1.18
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.1.10
20303 INFO: [deps        ] Successfully imported "kivy_deps.angle" 0.1.10
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.1.12
20306 INFO: [deps        ] Successfully imported "kivy_deps.glew" 0.1.12
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.1.23
20309 INFO: [deps        ] Successfully imported "kivy_deps.sdl2" 0.1.23
[INFO   ] [Kivy        ] v1.11.1
20313 INFO: [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\__init__.py"
20316 INFO: [Kivy        ] Installed at "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
20318 INFO: [Python      ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "C:\Users\samto\AppData\Local\Programs\Python\Python37\python.exe"
20325 INFO: [Python      ] Interpreter at "C:\Users\samto\AppData\Local\Programs\Python\Python37\python.exe"
[INFO   ] [Factory     ] 184 symbols loaded
20343 INFO: [Factory     ] 184 symbols loaded
[INFO   ] [Logger      ] Record log in C:\Users\samto\.kivy\logs\kivy_20-09-07_24.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.gstreamer" 0.1.18
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.1.10
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.1.12
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.1.23
[INFO   ] [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "C:\Users\samto\AppData\Local\Programs\Python\Python37\python.exe"
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[WARNING] [Could not find GStreamer plugins. Possible solution] set GST_PLUGIN_PATH
21626 WARNING: [Could not find GStreamer plugins. Possible solution] set GST_PLUGIN_PATH
[INFO   ] [Logger      ] Record log in C:\Users\samto\.kivy\logs\kivy_20-09-07_25.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.gstreamer" 0.1.18
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.1.10
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.1.12
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.1.23
[INFO   ] [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "C:\Users\samto\AppData\Local\Programs\Python\Python37\python.exe"
[INFO   ] [AudioGstplayer] Using Gstreamer 1.16.0.0
[INFO   ] [Audio       ] Providers: audio_gstplayer, audio_sdl2 (audio_ffpyplayer ignored)
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO   ] [Camera      ] Provider: opencv(['camera_picamera', 'camera_gi'] ignored)
[INFO   ] [Clipboard   ] Provider: winctypes
[INFO   ] [Factory     ] 184 symbols loaded
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] GLEW initialization succeeded
[INFO   ] [GL          ] Backend used <glew>
[INFO   ] [GL          ] OpenGL version <b'4.5.0 - Build 23.20.16.4849'>
[INFO   ] [GL          ] OpenGL vendor <b'Intel'>
[INFO   ] [GL          ] OpenGL renderer <b'Intel(R) HD Graphics 630'>
[INFO   ] [GL          ] OpenGL parsed version: 4, 5
[INFO   ] [GL          ] Shading version <b'4.50 - Build 23.20.16.4849'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [Spelling    ] Provider: enchant
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [VideoGstplayer] Using Gstreamer 1.16.0.0
[INFO   ] [Video       ] Provider: gstplayer
31989 INFO: Processing pre-find module path hook site from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.py'.
31991 INFO: site: retargeting to fake-dir 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\fake-modules'
46282 INFO: Import to be excluded not found: '_tkinter'
46283 INFO: Excluding import 'twisted'
46292 INFO:   Removing import of twisted from module kivy.support
46296 INFO: Import to be excluded not found: 'tkinter'
46297 INFO: Loading module hook 'hook-lib2to3.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks'...
46443 INFO: Loading module hook 'hook-numpy.core.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks'...
46712 INFO: Loading module hook 'hook-numpy.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks'...
46719 INFO: Loading module hook 'hook-pkg_resources.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks'...
47748 INFO: Processing pre-safe import module hook win32com from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\pre_safe_import_module\\hook-win32com.py'.
48478 WARNING: Hidden import "pkg_resources.py2_warn" not found!
48479 WARNING: Hidden import "pkg_resources.markers" not found!
48485 INFO: Excluding import '__main__'
48487 INFO:   Removing import of __main__ from module pkg_resources
48488 INFO: Loading module hook 'hook-pygments.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks'...
54698 INFO: Loading module hook 'hook-setuptools.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks'...
56076 INFO: Loading module hook 'hook-sysconfig.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks'...
56080 INFO: Loading module hook 'hook-xml.dom.domreg.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks'...
56082 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks'...
56084 INFO: Loading module hook 'hook-xml.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks'...
56087 INFO: Loading module hook 'hook-cv2.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
56099 INFO: Loading module hook 'hook-docutils.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
60374 INFO: Loading module hook 'hook-enchant.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
60559 INFO: Import to be excluded not found: 'enchant.tests'
60559 INFO: Loading module hook 'hook-pythoncom.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
61055 INFO: Loading module hook 'hook-pywintypes.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
61656 INFO: Loading module hook 'hook-win32com.py' from 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
63053 INFO: Looking for ctypes DLLs
63129 INFO: Analyzing run-time hooks ...
63138 INFO: Including run-time hook 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_kivy.py'
63149 INFO: Including run-time hook 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgres.py'
63160 INFO: Including run-time hook 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py'
63176 INFO: Including run-time hook 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_win32comgenpy.py'
63192 INFO: Including run-time hook 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_gstreamer.py'
63206 INFO: Including run-time hook 'C:\\Users\\samto\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\rthooks\\pyi_rth_enchant.py'
63261 INFO: Looking for dynamic libraries
63734 WARNING: lib not found: libgcc_s_seh-1.dll dependency of C:\Users\samto\AppData\Roaming\Python\Python37\site-packages\enchant\data\mingw64\lib\enchant-2\enchant_hunspell.dll
63786 WARNING: lib not found: libhunspell-1.6-0.dll dependency of C:\Users\samto\AppData\Roaming\Python\Python37\site-packages\enchant\data\mingw64\lib\enchant-2\enchant_hunspell.dll
63791 WARNING: lib not found: libenchant-2.dll dependency of C:\Users\samto\AppData\Roaming\Python\Python37\site-packages\enchant\data\mingw64\lib\enchant-2\enchant_hunspell.dll
63796 WARNING: lib not found: libglib-2.0-0.dll dependency of C:\Users\samto\AppData\Roaming\Python\Python37\site-packages\enchant\data\mingw64\lib\enchant-2\enchant_hunspell.dll
63862 WARNING: lib not found: libffi-6.dll dependency of C:\Users\samto\AppData\Roaming\Python\Python37\site-packages\enchant\data\mingw64\bin\libp11-kit-0.dll
64242 WARNING: lib not found: libffi-6.dll dependency of C:\Users\samto\AppData\Roaming\Python\Python37\site-packages\enchant\data\mingw64\bin\libgobject-2.0-0.dll
66849 INFO: Looking for eggs
66850 INFO: Using Python library C:\Users\samto\AppData\Local\Programs\Python\Python37\python37.dll
66850 INFO: Found binding redirects:
[]
66864 INFO: Warnings written to C:\Users\samto\Documenti\build\YouTube2mp3\warn-YouTube2mp3.txt
67039 INFO: Graph cross-reference written to C:\Users\samto\Documenti\build\YouTube2mp3\xref-YouTube2mp3.html
67129 INFO: Appending 'datas' from .spec
67141 INFO: checking PYZ
67185 INFO: Building because name changed
67185 INFO: Building PYZ (ZlibArchive) C:\Users\samto\Documenti\build\YouTube2mp3\PYZ-00.pyz
69450 INFO: Building PYZ (ZlibArchive) C:\Users\samto\Documenti\build\YouTube2mp3\PYZ-00.pyz completed successfully.
69488 INFO: checking Tree
70165 INFO: Building because root changed
70166 INFO: Building Tree Tree-00.toc
 Traceback (most recent call last):
70168 WARNING: stderr: Traceback (most recent call last):
   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
70171 WARNING: stderr:   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
     "__main__", mod_spec)
70173 WARNING: stderr:     "__main__", mod_spec)
   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
70174 WARNING: stderr:   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
     exec(code, run_globals)
70178 WARNING: stderr:     exec(code, run_globals)
   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\__main__.py", line 121, in <module>
70180 WARNING: stderr:   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\__main__.py", line 121, in <module>
     run()
70194 WARNING: stderr:     run()
   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\__main__.py", line 114, in run
70195 WARNING: stderr:   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\__main__.py", line 114, in run
     run_build(pyi_config, spec_file, **vars(args))
70199 WARNING: stderr:     run_build(pyi_config, spec_file, **vars(args))
   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
70203 WARNING: stderr:   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
     PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
70205 WARNING: stderr:     PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\building\build_main.py", line 720, in main
70209 WARNING: stderr:   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\building\build_main.py", line 720, in main
     build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
70227 WARNING: stderr:     build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\building\build_main.py", line 667, in build
70230 WARNING: stderr:   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\building\build_main.py", line 667, in build
     exec(code, spec_namespace)
70235 WARNING: stderr:     exec(code, spec_namespace)
   File "YouTube2mp3.spec", line 21, in <module>
70235 WARNING: stderr:   File "YouTube2mp3.spec", line 21, in <module>
     exe = EXE(pyz, Tree('C:\\Users\\samto\\Documenti'),
70238 WARNING: stderr:     exe = EXE(pyz, Tree('C:\\Users\\samto\\Documenti'),
   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\building\datastruct.py", line 220, in __init__
70244 WARNING: stderr:   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\building\datastruct.py", line 220, in __init__
     self.__postinit__()
70261 WARNING: stderr:     self.__postinit__()
   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
70264 WARNING: stderr:   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
     self.assemble()
70270 WARNING: stderr:     self.assemble()
   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\building\datastruct.py", line 272, in assemble
70272 WARNING: stderr:   File "C:\Users\samto\AppData\Local\Programs\Python\Python37\lib\site-packages\PyInstaller\building\datastruct.py", line 272, in assemble
     for filename in os.listdir(dir):
70279 WARNING: stderr:     for filename in os.listdir(dir):
 PermissionError: [WinError 5] Accesso negato: 'C:\\Users\\samto\\Documenti'
70283 WARNING: stderr: PermissionError: [WinError 5] Accesso negato: 'C:\\Users\\samto\\Documenti'

即使我以管理员身份打开提示,我也会收到此消息

编辑:如果我从提示符运行它,我会得到以下结果:

C:\Users\samto\Documenti\dist\YouTube2mp3>YouTube2mp3.exe
[INFO   ] [Logger      ] Record log in C:\Users\samto\.kivy\logs\kivy_20-09-08_0.txt
[INFO   ] [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "C:\Users\samto\Documenti\dist\YouTube2mp3\kivy\__init__.pyc"
[INFO   ] [Python      ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "C:\Users\samto\Documenti\dist\YouTube2mp3\YouTube2mp3.exe"
[INFO   ] [Factory     ] 184 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
 C:\Users\samto\Documenti\dist\YouTube2mp3\pydub\utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] GLEW initialization succeeded
[INFO   ] [GL          ] Backend used <glew>
[INFO   ] [GL          ] OpenGL version <b'4.5.0 - Build 23.20.16.4849'>
[INFO   ] [GL          ] OpenGL vendor <b'Intel'>
[INFO   ] [GL          ] OpenGL renderer <b'Intel(R) HD Graphics 630'>
[INFO   ] [GL          ] OpenGL parsed version: 4, 5
[INFO   ] [GL          ] Shading version <b'4.50 - Build 23.20.16.4849'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <32>
[WARNING] [Image       ] Unable to load image <C:\Users\samto\Documenti\dist\YouTube2mp3\kivy_install\data\glsl\default.png>
[CRITICAL] [Window      ] Unable to find any valuable Window provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
sdl2 - Exception: SDL2: Unable to load image
  File "kivy\core\__init__.py", line 71, in core_select_lib
  File "kivy\core\window\window_sdl2.py", line 152, in __init__
  File "kivy\core\window\__init__.py", line 981, in __init__
  File "kivy\core\window\window_sdl2.py", line 312, in create_window
  File "kivy\core\window\__init__.py", line 1258, in create_window
  File "kivy\graphics\instructions.pyx", line 783, in kivy.graphics.instructions.RenderContext.__init__
  File "kivy\core\image\__init__.py", line 561, in __init__
  File "kivy\core\image\__init__.py", line 756, in _set_filename
  File "kivy\core\image\__init__.py", line 460, in load
  File "kivy\core\image\__init__.py", line 223, in __init__
  File "kivy\core\image\img_sdl2.py", line 47, in load

[CRITICAL] [App         ] Unable to get a Window, abort.

Tags: inpyinfolibpackageslocalsitehook