首页 > 解决方案 > pyinstaller制作exe文件后程序不起作用

问题描述

我使用 numpy、sympy、sys 制作了一个 Python 程序,它在 IDE 中运行良好。这是代码...

import numpy as np
from sympy import *
import sys

f = open("result.txt", 'w+')
for line in sys.stdin:
    f.write(line)
f.close()
f = open("result.txt", 'r')
data = f.read().split("\n")
i = 0
while i < len(data):
    data[i] = data[i].split(' ')
    i += 1
print(data)
amount = int(data[0][0])
print(amount)
matrix = np.zeros((amount, amount))
i = 0
j = 0

while i < amount:
    while j < amount:
        matrix[i, j] = int(data[i + 1][j])
        j += 1
    j = 0
    i += 1
i = 0
j = 0
counter = 0
formula = 1
while i < amount:
    while j < amount:
        if matrix[i, j] == 1:
            x = symbols(str(i + 1))
            y = symbols(str(j + 1))
            if counter == 0:
                formula = (~x | ~y)
                counter += 1
            else:
                formula = formula & (~x | ~y)
        j += 1
    j = 0
    i += 1
formula_to_string = pycode(simplify_logic(formula, form='dnf', force=True))
massive_to_parse = formula_to_string.split("or")
k = 1
i = 0
while i < len(massive_to_parse):
    print("{", end='')
    while k < amount + 1:
        try:
            massive_to_parse[i].index(str(k))
        except ValueError:
            print("V",k, sep='', end='')
        finally:
            k += 1
    print("}-максимальное внутренне устойчивое множество")
    k = 1
    i += 1

然后我用这个命令使用pyinstaller制作了一个exe文件......

pyinstaller main.py

但是当我启动它时,会出现此错误。 错误

我该如何解决这个问题?因为我需要大学的 exe 文件才能从 C 上的其他程序启动它

标签: pythonpython-3.xpyinstallersympysys

解决方案


推荐阅读