[英]When i try to build an executable file with pyinstaller only a .spec file is created, How do i build an executable with pyinstaller
Am using Anaconda prompt, after navigating to the folder where the python code is, i ran the command pyinstaller --onefile exercise9.py I noticed that only a file called exercise9.spec was created.我正在使用 Anaconda 提示符,在导航到 python 代码所在的文件夹后,我运行了命令 pyinstaller --onefile exercise9.py 我注意到只创建了一个名为 exercise9.spec 的文件。 i did not see the dist folder where am suppose to find the.exe file as stated by the tutorials am using.
我没有看到我想在其中找到.exe 文件的 dist 文件夹,如正在使用的教程中所述。
Here is the python code am trying to execute这是我试图执行的 python 代码
from getpass import getpass
def login():
username = input("Please enter your username: ")
password = getpass("Please enter your password: ")
return [username, password]
try:
login_details = login()
if login_details[0] != "admin":
raise ValueError()
elif login_details[1] != "password":
print("Wrong Password")
else:
print("Login successful")
input("Press enter to exit")
except ValueError:
print("Wrong User name")
Here is the content of the exercise9.spec file这是exercise9.spec文件的内容
block_cipher = None
a = Analysis(['exercise9.py'],
pathex=['C:\\Users\\USER\\Desktop\\schoology\\exer9'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='exercise9',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )
help me out please i tried with other gui codes i wrote too, but only.spec file is created, am using windows 7.请帮帮我,我也尝试使用我编写的其他 gui 代码,但只创建了.spec 文件,我使用的是 windows 7。
I have been able to solve the issue by navigating to the scripts directory in anaconda prompt and entering this command:我已经能够通过导航到 anaconda 提示符中的脚本目录并输入以下命令来解决该问题:
python -m PyInstaller --onefile exercise9.py
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.