我正在尝试使用Pyinstaller将python脚本编译成.exe。 我使用的是python 2.7,Pyinstaller 3.2和windows 7。
脚本使用名为“logilab”的模块,另一个名为“logilab.constraint”。
我已经使用pip成功安装了两个模块。 脚本运行正常,但在尝试运行.exe时出现以下错误:
Traceback (most recent call last):
File "schedule_maker.py", line 1, in <module>
ImportError: No module named logilab.constraint
Failed to execute script schedule_maker
这是Pyinstaller日志:
490 INFO: PyInstaller: 3.2
490 INFO: Python: 2.7.11
490 INFO: Platform: Windows-7-6.1.7601-SP1
493 INFO: wrote c:\Scripts\Employee-Scheduler-master\schedule\schedule_maker.spe
c
496 INFO: UPX is not available.
497 INFO: Extending PYTHONPATH with paths
['c:\\Scripts\\Employee-Scheduler-master\\schedule',
'C:\\Python27\\Lib\\site-packages',
'c:\\Scripts\\Employee-Scheduler-master\\schedule']
498 INFO: checking Analysis
513 INFO: Building because pathex changed
514 INFO: Initializing module dependency graph...
519 INFO: Initializing module graph hooks...
595 INFO: running Analysis out00-Analysis.toc
608 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executable
required by C:\Python27\python.exe
692 INFO: Found C:\WINDOWS\WinSxS\Manifests\x86_policy.9.0.microsoft.vc90.crt_1f
c8b3b9a1e18e3b_9.0.21022.8_none_60a5df56e60dc5df.manifest
710 INFO: Found C:\WINDOWS\WinSxS\Manifests\x86_policy.9.0.microsoft.vc90.crt_1f
c8b3b9a1e18e3b_9.0.30729.1_none_8550c6b5d18a9128.manifest
715 INFO: Found C:\WINDOWS\WinSxS\Manifests\x86_policy.9.0.microsoft.vc90.crt_1f
c8b3b9a1e18e3b_9.0.30729.4148_none_f47e1bd6f6571810.manifest
727 INFO: Found C:\WINDOWS\WinSxS\Manifests\x86_policy.9.0.microsoft.vc90.crt_1f
c8b3b9a1e18e3b_9.0.30729.4940_none_f47ed0f6f6564d90.manifest
812 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.307
29.4940_none ...
812 INFO: Found manifest C:\WINDOWS\WinSxS\Manifests\x86_microsoft.vc90.crt_1fc8
b3b9a1e18e3b_9.0.30729.4940_none_50916076bcb9a742.manifest
825 INFO: Searching for file msvcr90.dll
825 INFO: Found file C:\WINDOWS\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9
.0.30729.4940_none_50916076bcb9a742\msvcr90.dll
825 INFO: Searching for file msvcp90.dll
826 INFO: Found file C:\WINDOWS\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9
.0.30729.4940_none_50916076bcb9a742\msvcp90.dll
826 INFO: Searching for file msvcm90.dll
826 INFO: Found file C:\WINDOWS\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9
.0.30729.4940_none_50916076bcb9a742\msvcm90.dll
904 INFO: Found C:\WINDOWS\WinSxS\Manifests\x86_policy.9.0.microsoft.vc90.crt_1f
c8b3b9a1e18e3b_9.0.21022.8_none_60a5df56e60dc5df.manifest
907 INFO: Found C:\WINDOWS\WinSxS\Manifests\x86_policy.9.0.microsoft.vc90.crt_1f
c8b3b9a1e18e3b_9.0.30729.1_none_8550c6b5d18a9128.manifest
908 INFO: Found C:\WINDOWS\WinSxS\Manifests\x86_policy.9.0.microsoft.vc90.crt_1f
c8b3b9a1e18e3b_9.0.30729.4148_none_f47e1bd6f6571810.manifest
909 INFO: Found C:\WINDOWS\WinSxS\Manifests\x86_policy.9.0.microsoft.vc90.crt_1f
c8b3b9a1e18e3b_9.0.30729.4940_none_f47ed0f6f6564d90.manifest
911 INFO: Adding redirect Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0,
30729, 4940)
4608 INFO: Caching module hooks...
4611 INFO: Analyzing c:\Scripts\Employee-Scheduler-master\schedule\schedule_make
r.py
6958 INFO: Loading module hooks...
6958 INFO: Loading module hook "hook-logilab.py"...
6963 INFO: Loading module hook "hook-encodings.py"...
8536 INFO: Looking for ctypes DLLs
8536 INFO: Analyzing run-time hooks ...
8543 INFO: Looking for dynamic libraries
9572 INFO: Looking for eggs
9572 INFO: Using Python library C:\WINDOWS\system32\python27.dll
9572 INFO: Found binding redirects:
[BindingRedirect(name=u'Microsoft.VC90.CRT', language=None, arch=u'x86', oldVers
ion=(9, 0, 21022, 8), newVersion=(9, 0, 30729, 4940), publicKeyToken=u'1fc8b3b9a
1e18e3b')]
9582 INFO: Warnings written to c:\Scripts\Employee-Scheduler-master\schedule\bui
ld\schedule_maker\warnschedule_maker.txt
9622 INFO: checking PYZ
9692 INFO: checking PKG
9695 INFO: Building because c:\Scripts\Employee-Scheduler-master\schedule\build\
schedule_maker\schedule_maker.exe.manifest changed
9697 INFO: Building PKG (CArchive) out00-PKG.pkg
9951 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 307
29, 4940)
11652 INFO: Bootloader C:\Python27\lib\site-packages\pyinstaller-3.2-py2.7.egg\P
yInstaller\bootloader\Windows-32bit\run.exe
11654 INFO: checking EXE
11655 INFO: Rebuilding out00-EXE.toc because pkg is more recent
11657 INFO: Building EXE from out00-EXE.toc
11657 INFO: Appending archive to EXE c:\Scripts\Employee-Scheduler-master\schedu
le\dist\schedule_maker.exe
我使用以下命令构建:
pyinstaller --onefile schedule_maker.py
我尝试在命令中添加logilab.constraint的安装路径:
pyinstaller --onefile --paths=C:\Python27\Lib\site-packages\ schedule_maker.py
有什么想法吗?我错过了什么吗?
答案 0 :(得分:0)
在脚本的第一行(schedule_maker.py)上添加
function set( $key, $value)
{
$key = strtolower( $key );
try{
$_SESSION["HA::STORE"][$key] = serialize($value);
} catch (\Exception $e) {
// Catch the exception thrown and handle it however you want
}
}
基本上pyinstallers分析可能没有意识到你需要那个包
答案 1 :(得分:0)
显然只是从他们的&#34; setup.py&#34;安装模块。档案还不够,我不得不
Form hi = new Form("Hi World");
Toolbar bar = new Toolbar();
hi.setToolbar(bar);
bar.addCommandToSideMenu(new Command("test 1"));
bar.addCommandToSideMenu(new Command("test 2"));
hi.addComponent(new Label("Hi World"));
bar.getMenuBar().addPointerPressedListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent evt) {
System.out.println("Side menu or Hamburner Menu is clicked");
}
});
hi.show();
他们两个。 修好了。