Python 2.7 pyinstaller for python 2.7.9获取可执行文件,当运行该文件时,该文件在屏幕上闪烁

Python 2.7 pyinstaller for python 2.7.9获取可执行文件,当运行该文件时,该文件在屏幕上闪烁,python-2.7,pyinstaller,pywin32,Python 2.7,Pyinstaller,Pywin32,嗨,我安装了pyinstaller和pywin32 64位版本以获取.exe。 我确实生成了一个.exe,但当我双击它时,它只会在屏幕上闪烁并关闭。我将此用作setup.py from distutils.core import setup import py2exe setup(console=['BP.py']) 脚本BP.py要求用户输入一些值并绘制一些图 有什么想法吗 谢谢 下面是代码 BP.py的代码如下所示 ## ##BP.py import matplotlib.pyplot a

嗨,我安装了pyinstaller和pywin32 64位版本以获取.exe。 我确实生成了一个.exe,但当我双击它时,它只会在屏幕上闪烁并关闭。我将此用作setup.py

from distutils.core import setup
import py2exe
setup(console=['BP.py'])
脚本BP.py要求用户输入一些值并绘制一些图

有什么想法吗

谢谢

下面是代码

BP.py的代码如下所示

##
##BP.py
import matplotlib.pyplot as plt
import numpy as np





# A function to plot the lines

def plot_lines(x,y,colors,j):


    ax = plt.subplot(2,2,j)


    for i in range(len(colors)):
        plt.plot(x,y[i],colors[i])





def plot_setup():
    fig = plt.figure()
    plt.xlabel('x')
    plt.ylabel('y')
    plt.grid(True)


def Max_avg(row,col,x,colors,ao1,ao2,j,a_list):

    for a in a_list:

        i = 0
        y_a1 = np.zeros((row,col))
        y_a2 = np.zeros((row,col))
        y = np.zeros((row,col))

        for ao1_v,ao2_v in zip(ao1,ao2):

            y_a1[i] = 3*x**2
            y_a2[i] = 5*x
            y[i] = np.add(y_a1[i],y_a2[i])
            i = i+1

        plot_lines(x,y,colors,j)`enter code here`
        j = j+1


def main():
    x1 = -10
    x2 = 10
    numpts = 100
    x = np.linspace(x1,x2,numpts,endpoint=True)
    col = len(x)
#    a_list = [-1.7,-5]
    print "Please enter a list of coefficients seperated by a white space."
    string_input = raw_input()
    a_list = string_input.split()
    a_list = [int(a) for a in a_list]
    ao1 = (-5.0,2.0)
    ao2 = (1.0,10.0)
    col_plt = 2
    colors = ['b','g']
    j = 1

    plot_setup()

    Max_avg(2,col,x,colors,ao1,ao2,j,a_list)

    plt.show()


if __name__ == "__main__":
    main()

你能在这里发布你的脚本吗?@Junaos代码已放置。谢谢