iT邦幫忙

0

python pyinstaller/auto-py-to-exe 打包失敗

  • 分享至 

  • xImage

https://ithelp.ithome.com.tw/upload/images/20220524/201447981DfklV8dTQ.png

Windows PowerShell
Copyright (C) Microsoft Corporation. 著作權所有,並保留一切權利。

請嘗試新的跨平台 PowerShell https://aka.ms/pscore6

PS C:\Users\USER> py -m pip install auto-py-to-exe
Requirement already satisfied: auto-py-to-exe in c:\python\lib\site-packages (2.20.0)
Requirement already satisfied: pyinstaller>=4.6 in c:\python\lib\site-packages (from auto-py-to-exe) (5.1)
Requirement already satisfied: Eel==0.12.4 in c:\python\lib\site-packages (from auto-py-to-exe) (0.12.4)
Requirement already satisfied: bottle in c:\python\lib\site-packages (from Eel==0.12.4->auto-py-to-exe) (0.12.19)
Requirement already satisfied: bottle-websocket in c:\python\lib\site-packages (from Eel==0.12.4->auto-py-to-exe) (0.2.9)
Requirement already satisfied: future in c:\python\lib\site-packages (from Eel==0.12.4->auto-py-to-exe) (0.18.2)
Requirement already satisfied: whichcraft in c:\python\lib\site-packages (from Eel==0.12.4->auto-py-to-exe) (0.6.1)
Requirement already satisfied: altgraph in c:\python\lib\site-packages (from pyinstaller>=4.6->auto-py-to-exe) (0.17.2)
Requirement already satisfied: pywin32-ctypes>=0.2.0 in c:\python\lib\site-packages (from pyinstaller>=4.6->auto-py-to-exe) (0.2.0)
Requirement already satisfied: pyinstaller-hooks-contrib>=2021.4 in c:\python\lib\site-packages (from pyinstaller>=4.6->auto-py-to-exe) (2022.5)
Requirement already satisfied: pefile>=2017.8.1 in c:\python\lib\site-packages (from pyinstaller>=4.6->auto-py-to-exe) (2021.9.3)
Requirement already satisfied: setuptools in c:\python\lib\site-packages (from pyinstaller>=4.6->auto-py-to-exe) (58.1.0)
Requirement already satisfied: gevent-websocket in c:\python\lib\site-packages (from bottle-websocket->Eel==0.12.4->auto-py-to-exe) (0.10.1)
Requirement already satisfied: gevent in c:\python\lib\site-packages (from gevent-websocket->bottle-websocket->Eel==0.12.4->auto-py-to-exe) (21.12.0)
Requirement already satisfied: zope.interface in c:\python\lib\site-packages (from gevent->gevent-websocket->bottle-websocket->Eel==0.12.4->auto-py-to-exe) (5.4.0)
Requirement already satisfied: cffi>=1.12.2 in c:\python\lib\site-packages (from gevent->gevent-websocket->bottle-websocket->Eel==0.12.4->auto-py-to-exe) (1.15.0)
Requirement already satisfied: zope.event in c:\python\lib\site-packages (from gevent->gevent-websocket->bottle-websocket->Eel==0.12.4->auto-py-to-exe) (4.5.0)
Requirement already satisfied: greenlet<2.0,>=1.1.0 in c:\python\lib\site-packages (from gevent->gevent-websocket->bottle-websocket->Eel==0.12.4->auto-py-to-exe) (1.1.2)
Requirement already satisfied: pycparser in c:\python\lib\site-packages (from cffi>=1.12.2->gevent->gevent-websocket->bottle-websocket->Eel==0.12.4->auto-py-to-exe) (2.21)
PS C:\Users\USER> py -m auto-py-to-exe
C:\Python\python.exe: No module named auto-py-to-exe
PS C:\Users\USER>

已經安裝了但是還是會依直出現 No module named XXX

pyinstaller/auto-py-to-exe 這兩種方法都會失敗..
請問各位該如何解決

froce iT邦大師 1 級 ‧ 2022-05-24 14:45:53 檢舉
直接執行 auto-py-to-exe,這本身應該是個執行檔,不用 py -m。
如果cmd出現找不到 auto-py-to-exe ,你得自己加到環境變數或是cd到auto-py-to-exe所在的資料夾內。
oserjeng iT邦新手 5 級 ‧ 2022-05-24 14:54:55 檢舉
是因為沒有加上 py -m 無法執行 所以才加上的
froce iT邦大師 1 級 ‧ 2022-05-24 15:33:36 檢舉
我第二行就是在說你提到的狀況,這個基礎的看不懂我也沒辦法救你...
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

0
echochio
iT邦高手 1 級 ‧ 2022-05-24 20:45:50

這邊一個步驟到底可以的不知道你的問題

依照你的環境應該有 C:\Python\Scripts\auto-py-to-exe.exe

https://ithelp.ithome.com.tw/upload/images/20220524/201106118ykGWVid6u.png
https://ithelp.ithome.com.tw/upload/images/20220524/20110611fD4wR9gEZP.png
https://ithelp.ithome.com.tw/upload/images/20220524/20110611QV5u99bsZK.png

D:\>
D:\>
D:\>
D:\>pip install pyinstaller
Collecting pyinstaller
  Downloading pyinstaller-5.1-py3-none-win_amd64.whl (1.2 MB)
     ---------------------------------------- 1.2/1.2 MB 728.2 kB/s eta 0:00:00
Collecting altgraph
  Downloading altgraph-0.17.2-py2.py3-none-any.whl (21 kB)
Requirement already satisfied: importlib-metadata in d:\python37\lib\site-packages (from pyinstaller) (4.10.1)
Collecting pefile>=2017.8.1
  Using cached pefile-2021.9.3.tar.gz (72 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: setuptools in d:\python37\lib\site-packages (from pyinstaller) (39.0.1)
Collecting pyinstaller-hooks-contrib>=2021.4
  Downloading pyinstaller_hooks_contrib-2022.5-py2.py3-none-any.whl (231 kB)
     ---------------------------------------- 231.2/231.2 KB 1.1 MB/s eta 0:00:00
Collecting pywin32-ctypes>=0.2.0
  Using cached pywin32_ctypes-0.2.0-py2.py3-none-any.whl (28 kB)
Requirement already satisfied: future in d:\python37\lib\site-packages (from pefile>=2017.8.1->pyinstaller) (0.18.2)
Requirement already satisfied: zipp>=0.5 in d:\python37\lib\site-packages (from importlib-metadata->pyinstaller) (3.7.0)
Requirement already satisfied: typing-extensions>=3.6.4 in d:\python37\lib\site-packages (from importlib-metadata->pyinstaller) (4.0.1)
Building wheels for collected packages: pefile
  Building wheel for pefile (setup.py) ... done
  Created wheel for pefile: filename=pefile-2021.9.3-py3-none-any.whl size=68831 sha256=bd65cd037010158ef514e432c179cd54042e50528b13fde4fd5c5fcdf7c289bb
  Stored in directory: c:\users\echoc\appdata\local\pip\cache\wheels\50\be\9b\d19a6151b9c6e303f823faedf03193d7e90dac4009a0bdafeb
Successfully built pefile
Installing collected packages: pywin32-ctypes, altgraph, pyinstaller-hooks-contrib, pefile, pyinstaller
Successfully installed altgraph-0.17.2 pefile-2021.9.3 pyinstaller-5.1 pyinstaller-hooks-contrib-2022.5 pywin32-ctypes-0.2.0
WARNING: You are using pip version 22.0.4; however, version 22.1.1 is available.
You should consider upgrading via the 'd:\python37\python.exe -m pip install --upgrade pip' command.

D:\>echo print('Hello') > hello.py

D:\>more hello.py
print('Hello')

D:\>pyinstaller -F hello.py
144 INFO: PyInstaller: 5.1
146 INFO: Python: 3.7.0
147 INFO: Platform: Windows-10-10.0.22000-SP0
149 INFO: wrote D:\hello.spec
151 INFO: UPX is not available.
158 INFO: Extending PYTHONPATH with paths
['D:\\']
596 INFO: checking Analysis
597 INFO: Building Analysis because Analysis-00.toc is non existent
598 INFO: Initializing module dependency graph...
601 INFO: Caching module graph hooks...
623 INFO: Analyzing base_library.zip ...
5093 INFO: Caching module dependency graph...
5246 INFO: running Analysis Analysis-00.toc
5263 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by d:\python37\python.exe
5937 INFO: Analyzing D:\hello.py
5939 INFO: Processing module hooks...
5940 INFO: Loading module hook 'hook-difflib.py' from 'd:\\python37\\lib\\site-packages\\PyInstaller\\hooks'...
5943 INFO: Loading module hook 'hook-encodings.py' from 'd:\\python37\\lib\\site-packages\\PyInstaller\\hooks'...
6012 INFO: Loading module hook 'hook-heapq.py' from 'd:\\python37\\lib\\site-packages\\PyInstaller\\hooks'...
6014 INFO: Loading module hook 'hook-pickle.py' from 'd:\\python37\\lib\\site-packages\\PyInstaller\\hooks'...
6016 INFO: Loading module hook 'hook-platform.py' from 'd:\\python37\\lib\\site-packages\\PyInstaller\\hooks'...
6017 INFO: Loading module hook 'hook-xml.py' from 'd:\\python37\\lib\\site-packages\\PyInstaller\\hooks'...
6298 INFO: Looking for ctypes DLLs
6298 INFO: Analyzing run-time hooks ...
6301 INFO: Including run-time hook 'd:\\python37\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_subprocess.py'
6303 INFO: Looking for dynamic libraries
6874 INFO: Looking for eggs
6874 INFO: Using Python library d:\python37\python37.dll
6875 INFO: Found binding redirects:
[]
6879 INFO: Warnings written to D:\build\hello\warn-hello.txt
6897 INFO: Graph cross-reference written to D:\build\hello\xref-hello.html
6909 INFO: checking PYZ
6910 INFO: Building PYZ because PYZ-00.toc is non existent
6911 INFO: Building PYZ (ZlibArchive) D:\build\hello\PYZ-00.pyz
7057 INFO: Building PYZ (ZlibArchive) D:\build\hello\PYZ-00.pyz completed successfully.
7066 INFO: checking PKG
7066 INFO: Building PKG because PKG-00.toc is non existent
7067 INFO: Building PKG (CArchive) hello.pkg
8818 INFO: Building PKG (CArchive) hello.pkg completed successfully.
8820 INFO: Bootloader d:\python37\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
8820 INFO: checking EXE
8823 INFO: Building EXE because EXE-00.toc is non existent
8823 INFO: Building EXE from EXE-00.toc
8824 INFO: Copying bootloader EXE to D:\dist\hello.exe.notanexecutable
8949 INFO: Copying icon to EXE
8950 INFO: Copying icons from ['d:\\python37\\lib\\site-packages\\PyInstaller\\bootloader\\images\\icon-console.ico']
9014 INFO: Writing RT_GROUP_ICON 0 resource with 104 bytes
9014 INFO: Writing RT_ICON 1 resource with 3752 bytes
9015 INFO: Writing RT_ICON 2 resource with 2216 bytes
9017 INFO: Writing RT_ICON 3 resource with 1384 bytes
9017 INFO: Writing RT_ICON 4 resource with 37019 bytes
9018 INFO: Writing RT_ICON 5 resource with 9640 bytes
9018 INFO: Writing RT_ICON 6 resource with 4264 bytes
9018 INFO: Writing RT_ICON 7 resource with 1128 bytes
9021 INFO: Copying 0 resources to EXE
9021 INFO: Embedding manifest in EXE
9023 INFO: Updating manifest in D:\dist\hello.exe.notanexecutable
9085 INFO: Updating resource type 24 name 1 language 0
9087 INFO: Appending PKG archive to EXE
10581 INFO: Building EXE from EXE-00.toc completed successfully.

D:\>dist\hello.exe
Hello

D:\>
0
apkasal
iT邦見習生 ‧ 2023-03-25 02:54:24

APKasal is a website that provides free downloads of modified Android apps and games (MOD APKs). These MOD APKs offer features that are not available in the original versions. However, using MOD APKs may violate the terms of service of app or game developers and may not be legal. APKasal Download Free MOD APKs

我要發表回答

立即登入回答