Cx_Freeze和youtube_dl缺少模块Windows

时间:2017-12-16 11:15:53

标签: python cx-freeze youtube-dl

我正在使用Cx_Freeze在Windows 10上从python脚本创建一个可执行文件(只有一个文件:mp3InThePocket.py)。当我在Ubuntu上尝试它时,一切正常。使用Windows时出现了很多问题。我设法解决了它们的负载,但我遇到了最后一个:在使用Cx_Freeze构建时似乎缺少模块。 我的setup.py:

#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python 3

import sys, os
from cx_Freeze import setup, Executable

includes = ["youtube_dl", "urllib", "os", "sys", "time", "re"]
excludes = []
packages = []
path = []


exe = Executable(
    script="mp3InThePocket.py",
    icon="./icone.ico",
)


setup(
    name="mp3InThePocket",
    version="1.00",
    description="",
    author="LDV",
    options = {"build_exe": {"includes": includes,
             "excludes": excludes,
             "packages": packages,
             "path": path
             }
       },
    executables=[exe]
)

以下是我在构建时获得的内容:

Missing modules:                                                                                 
? BaseHTTPServer imported from youtube_dl.compat                                                 
? Cookie imported from youtube_dl.compat                                                         
? Crypto.Cipher imported from youtube_dl.downloader.hls                                          
? HTMLParser imported from youtube_dl.compat                                                     
? __main__ imported from bdb, pdb                                                                
? _dummy_threading imported from dummy_threading                                                 
? _frozen_importlib imported from importlib, importlib.abc                                       
? _frozen_importlib_external imported from importlib, importlib._bootstrap, 
importlib.abc        ? _posixsubprocess imported from subprocess                                                      
? _scproxy imported from urllib.request                                                          
? ce imported from os                                                                            
? cookielib imported from youtube_dl.compat                                                      
? fcntl imported from pty, youtube_dl.utils                                                      
? future_builtins imported from youtube_dl.compat                                                
? grp imported from shutil, tarfile                                                              
? htmlentitydefs imported from youtube_dl.compat                                                 
? httplib imported from youtube_dl.compat                                                        
? java.lang imported from platform                                                               
? netbios imported from uuid                                                                     
? org.python.core imported from copy
....                                                             

This is not necessarily a problem - the modules may not be needed on this platform.  

奇怪的是,从控制台启动时可执行文件正常运行,但在单击它时却没有。 (youtube_dl发生错误,因为,我认为,那些缺少依赖项)

程序本身在使用Python自行启动(使用cx_freeze构建之前)时运行良好。

另一件需要知道的事情是我需要在Windows env变量中指定PATH到ffmpeg(我单独下载),以便youtube_dl与原始python脚本一起使用。

我从源目录安装了Cx Freeze(从github克隆并安装)

感谢您的帮助!

0 个答案:

没有答案