Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Pynsist生成python gui应用程序的exe时出现问题(对未使用的模块重复“ModuleNotFoundError”)_Python_Pynsist - Fatal编程技术网

使用Pynsist生成python gui应用程序的exe时出现问题(对未使用的模块重复“ModuleNotFoundError”)

使用Pynsist生成python gui应用程序的exe时出现问题(对未使用的模块重复“ModuleNotFoundError”),python,pynsist,Python,Pynsist,当我运行installer.cfg时,我不断得到代码中从未使用过的模块的“ModuleNotFoundError”。例如,第一次运行它时,我得到了“ModuleNotFoundError:没有名为'sip'的模块”,因此我将sip包括在installer.cfg文件中的包列表中,问题得到了解决。但随后出现了一个新的“ModuleNotFoundError”。因此,我不断地将越来越多的模块添加到installer.cfg文件中的包列表中 (我这样做是因为互联网上有人解释说他这样做解决了他与Pyns

当我运行installer.cfg时,我不断得到代码中从未使用过的模块的“ModuleNotFoundError”。例如,第一次运行它时,我得到了“ModuleNotFoundError:没有名为'sip'的模块”,因此我将sip包括在installer.cfg文件中的包列表中,问题得到了解决。但随后出现了一个新的“ModuleNotFoundError”。因此,我不断地将越来越多的模块添加到installer.cfg文件中的包列表中

(我这样做是因为互联网上有人解释说他这样做解决了他与Pynsist的问题:-我可能误解了这一点)

这就是我应该做的吗?这似乎没有什么意义,因为它要求我导入从未使用过的模块。我不知道我需要的随机模块列表何时结束。另外,这很麻烦,因为现在我得到了一个“ImportError:DLL加载失败:找不到指定的模块”(指tkinter),所以现在我必须安装一个我不使用的模块

installer.cfg:

[Application]
name=GUI
version=1.0
# How to launch the app - this calls the 'main' function from the 'myapp' 
package:
entry_point=gui:main

[Python]
version=3.6.5

[Include]
# Packages from PyPI that your application requires, one per line
packages = requests
  matplotlib
  seaborn
  numpy
  PyQt5
  sip
  six
  pyparsing
  cycler
  dateutil
  kiwisolver
  tkinter
  _tkinter
# These must have wheels on PyPI:
pypi_wheels = requests==2.18.4
     beautifulsoup4==4.6.0
     html5lib==0.999999999

# Other files and folders that should be installed
正在使用的模块:

import sys

from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *

import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
import seaborn as sns

import numpy as np
from numpy.linalg import inv

这些模块由其他模块使用,例如
PyQt5
imports
sip
。Pynsist在这方面故意相当愚蠢——我使用的工具试图自动完成这项工作,他们很容易出错。我制作了一个原型工具()来检测所有正在使用的模块,但它仍然非常原型化。为了避免使用tkinter,请在导入
Matplotlib.pyplot
之前为Matplotlib选择Qt5后端。更多信息请点击此处: