gpt4 book ai didi

python - 加载 Python dll/LoadLibrary : The specified module could not be found 时出错

转载 作者:行者123 更新时间:2023-11-28 17:11:18 27 4
gpt4 key购买 nike

我是编程新手。我用 python 编写了一个小程序,并使用 pyinstaller 将其转换为 .exe 文件。现在,当我尝试打开 .exe 文件时,出现黑屏并立即关闭。我能够获得屏幕截图:

enter image description here

我看到了一个解决方案,比如在代码末尾添加 input(),但它也没有用。我的代码:

import random

print("Hello, what is your name?")
name = str(input())
print("Well, " + name + ", I think of a number between 1 and 1000. Can you guess this number in 10 chances?")
number = random.randint(1, 1001)

for guessTaken in range(1, 11):
print("Take a guess")
guess = int(input())
if guess > number:
print("The number you think is too high")
elif guess < number:
print("The number you think is too low")
else:
break

if guess == number:
print("OK, " + name + ", you guessed the number in " + str(guessTaken) + " guesses")
else:
print("Unfortunatelly, you couldn't find the number. The number is " + str(number))

最佳答案

这对我有用:

Had the same issue but then realized that I was inadvertently trying to execute the file in the build folder instead of the dist folder.

Looks like you might be making the same mistake from your traceback so see if using the executable in dist doesn't fix it for you

(来源:https://stackoverflow.com/a/54119819/4607733)

关于python - 加载 Python dll/LoadLibrary : The specified module could not be found 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47289279/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com