Py2Exe - 找不到模块

问题描述

当我在 Windows 10 的命令提示符中运行 setup.py py2exe 时,我收到如下错误消息:

15 missing Modules
  ------------------
? Cookie                              imported from youtube_dl.compat
? Crypto                              imported from youtube_dl.downloader.hls
? Cryptodome                          imported from youtube_dl.extractor.ivi
? HTMLParser                          imported from youtube_dl.compat
? _posixshmem                         imported from multiprocessing.resource_tracker,multiprocessing.shared_memory
? cookielib                           imported from youtube_dl.compat
? pkg_resources.extern.appdirs        imported from pkg_resources
? pkg_resources.extern.packaging      imported from pkg_resources
? pkg_resources.extern.six            imported from pkg_resources
? readline                            imported from cmd,code,pdb
? urllib.urlretrieve                  imported from youtube_dl.compat
? xattr                               imported from youtube_dl.utils
? youtube_dl.extractor.lazy_extractors imported from youtube_dl.extractor
? youtubesearchpython.handlers        imported from youtubesearchpython.legacy
? youtubesearchpython.internal        imported from youtubesearchpython,youtubesearchpython.extras,youtubesearchpython.legacy,youtubesearchpython.search,youtubesearchpython.streamurlfetcher
Building 'dist\downloader.exe'.
error: [WinError 87] The parameter is incorrect.

我的 setup.py 包含以下内容

from youtubesearchpython import VideosSearch

import tkinter as tk
from tkinter import simpledialog
from mhyt import yt_download
import getpass


ROOT = tk.Tk()

ROOT.withdraw()
# the input dialog
USER_INP = simpledialog.askstring(title="Youtube Video Donloader",prompt="What is the title of the video?")


title = USER_INP

videosSearch = VideosSearch(title,limit = 2)


url = videosSearch.result()["result"][0]["link"]
name = videosSearch.result()["result"][0]["title"]
id = videosSearch.result()["result"][0]["id"]



yt_download(url,id + ".mp4")

myfile = open(id + '.mp4')

file = id + '.mp4'

print(id)
file = id + ".mp4"


username = getpass.getuser()
print(username)


def play_movie(path):
    from os import startfile
    startfile(path)


 
 

play_movie("C:/Users/" + username + "/Desktop/" + file)

 

我尝试在一个非常基本的 python 程序上运行 py2exe:print(1+1),它不需要任何模块来运行,但仍然出现类似的错误

  2 missing Modules
  ------------------
? _posixshmem                         imported from multiprocessing.resource_tracker,multiprocessing.shared_memory
? readline                            imported from cmd,pdb
Building 'dist\hello.exe'.
error: [WinError 87] The parameter is incorrect.
Anything that would help me fix the "missing modules" error would be appreciated!

任何帮助都不会使我受益,但也会使其他人受益。

谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)