能吧.py变成.exe吗?
正如标题,{:10_305:} ‘能把.py变成.exe吗?’,大家回答一下{:10_249:} 。怎么变(如果能)?{:10_257:} https://blog.csdn.net/tangdaxue43/article/details/84840643 pip install pyinstaller
pyinstaller <你的源文件> -c -f 本帖最后由 chinajz 于 2022-12-22 07:15 编辑
win11商店的python3.10安装使用后,pywin32_postinstall.py安装失败:
1、pip install pyinstaller
2、 pip install pypiwin32
3、 py --list-paths
找到安装和Scripts目录然后进入
进入 C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts目录:
4、python pywin32_postinstall.py -install
Parsed arguments are: Namespace(install=True, remove=False, wait=None, silent=False, quiet=False, destination='C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\\Lib\\site-packages')
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts\pywin32_postinstall.py", line 780, in <module>
main()
File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts\pywin32_postinstall.py", line 772, in main
install(args.destination)
File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts\pywin32_postinstall.py", line 429, in install
LoadSystemModule(lib_dir, "pywintypes")
File "C:\Users\Administrator\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts\pywin32_postinstall.py", line 192, in LoadSystemModule
mod = importlib.util.module_from_spec(spec)
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 1176, in create_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
ImportError: DLL load failed while importing pywintypes: 找不到指定的模块。 3楼的方法有效:
pyinstaller.exe C:\Users\Administrator\Desktop\Python\Pyt_iontest\t_matplotlib.py -c -F
pip install pyinstaller
pyinstaller <你的源文件> -c -F
生成的exe文件在当前的
.\dist
目录下 在vs2022安装的python为3.9,按一楼方法可以一直安装结束,奇怪的是没有生成pyinstaller-scrpt.py文件
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\Scripts>python pywin32_postinstall.py -install
Parsed arguments are: Namespace(install=True, remove=False, wait=None, silent=False, quiet=False, destination='C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python39_64\\Lib\\site-packages')
Copied pythoncom39.dll to C:\WINDOWS\system32\pythoncom39.dll
Copied pywintypes39.dll to C:\WINDOWS\system32\pywintypes39.dll
Registered: Python.Interpreter
Registered: Python.Dictionary
Registered: Python
-> Software\Python\PythonCore\3.9\Help=None
-> Software\Python\PythonCore\3.9\Help\Pythonwin Reference='C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python39_64\\Lib\\site-packages\\PyWin32.chm'
Registered help file
Pythonwin has been registered in context menu
Shortcut for Pythonwin created
Shortcut to documentation created
The pywin32 extensions were successfully installed.
--------------------------------
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\Scripts>dir py*
驱动器 C 中的卷是 win
卷的序列号是 0432-4EAB
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\Scripts 的目录
2022/12/2121:36 108,430 pyftmerge.exe
2022/12/2121:36 108,431 pyftsubset.exe
2022/12/2121:43 108,454 pyi-archive_viewer.exe
2022/12/2121:43 108,449 pyi-bindepend.exe
2022/12/2121:43 108,452 pyi-grab_version.exe
2022/12/2121:43 108,448 pyi-makespec.exe
2022/12/2121:43 108,451 pyi-set_version.exe
2022/12/2121:43 108,465 pyinstaller.exe
2022/12/2122:12 27,225 pywin32_postinstall.py
2022/12/2122:12 3,546 pywin32_testall.py
{:10_277:} chinajz 发表于 2022-12-21 22:01
pip install pyinstaller
pyinstaller-c -F
生成的exe文件在当前的
大佬大佬,\dist目录在哪 wyhpylc 发表于 2022-12-22 21:57
大佬大佬,\dist目录在哪
你在那个目录制作,就生在那个目录 chinajz 发表于 2022-12-22 22:17
你在那个目录制作,就生在那个目录
谢谢
页:
[1]