【发布时间】:2019-09-07 12:39:02
【问题描述】:
我在 Linux 机器上写了一个简单的 Python 脚本:
#!/bin/python
import wget
wget.download("<url>","/tmp)
这段代码运行良好,从 apache2 服务器下载文件并保存到 /tmp 文件夹
接下来我将位置从“/tmp”更改为“C:/”。我在我的 Windows 机器上安装了 Python、pip、pyInstaller 和 wget 模块。现在通过 pyInstaller 我想制作 .exe 文件,该文件从服务器下载文件并将其保存到光盘 C:/。 我以管理员身份运行 cmd:
pyInstaller "test.py"
输出:
70 INFO: PyInstaller: 3.5
70 INFO: Python: 3.7.4
70 INFO: Platform: Windows-10-10.0.18362-SP0
70 INFO: wrote C:\test.spec
70 INFO: UPX is not available.
70 INFO: Extending PYTHONPATH with paths
['C:\\', 'C:\\']
70 INFO: checking Analysis
70 INFO: Building Analysis because Analysis-00.toc is non existent
70 INFO: Initializing module dependency graph...
91 INFO: Initializing module graph hooks...
184 INFO: Analyzing base_library.zip ...
7545 INFO: running Analysis Analysis-00.toc
7559 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\users\tester\appdata\local\programs\python\python37-32\python.exe
7919 INFO: Caching module hooks...
8039 INFO: Analyzing C:\test.py
8620 INFO: Loading module hooks...
8620 INFO: Loading module hook "hook-encodings.py"...
8774 INFO: Loading module hook "hook-pydoc.py"...
8807 INFO: Loading module hook "hook-xml.py"...
8983 INFO: Looking for ctypes DLLs
8983 INFO: Analyzing run-time hooks ...
8996 INFO: Looking for dynamic libraries
9720 INFO: Looking for eggs
9720 INFO: Using Python library c:\users\tester\appdata\local\programs\python\python37-32\python37.dll
9720 INFO: Found binding redirects:
[]
9728 INFO: Warnings written to C:\build\test\warn-test.txt
9794 INFO: Graph cross-reference written to C:\build\test\xref-test.html
9855 INFO: checking PYZ
9855 INFO: Building PYZ because PYZ-00.toc is non existent
9855 INFO: Building PYZ (ZlibArchive) C:\build\test\PYZ-00.pyz
10478 INFO: Building PYZ (ZlibArchive) C:\build\test\PYZ-00.pyz completed successfully.
10511 INFO: checking PKG
10511 INFO: Building PKG because PKG-00.toc is non existent
10511 INFO: Building PKG (CArchive) PKG-00.pkg
10531 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
10543 INFO: Bootloader c:\users\tester\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run.exe
10543 INFO: checking EXE
10543 INFO: Building EXE because EXE-00.toc is non existent
10543 INFO: Building EXE from EXE-00.toc
10543 INFO: Appending archive to EXE C:\build\test\test.exe
10616 INFO: Building EXE from EXE-00.toc completed successfully.
10616 INFO: checking COLLECT
10636 INFO: Building COLLECT because COLLECT-00.toc is non existent
10636 INFO: Building COLLECT COLLECT-00.toc
11835 INFO: Building COLLECT COLLECT-00.toc completed successfully.
当我运行编译后的脚本时,C:/ 中什么也没有出现
问题是:我是否遗漏了什么或做错了什么?我应该手动将 wget 模块添加到 pyInstaller 命令吗?或者我只是不了解 pyInstaller 文档并且无法在 Windows .exe 文件中使用外部模块?
【问题讨论】:
标签: python windows exe wget pyinstaller