我在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文档,并且无法在.exe文件中使用外部模块?
发布于 2019-09-07 13:17:01
我不认为这是蟒蛇的问题。尝试更改用户配置文件的路径。或者以管理员的身份运行应用程序。
我不建议保存到c:\无论如何,除非你有一个很好的理由。
https://stackoverflow.com/questions/57833769
复制相似问题