因为我们的测试压力机大部分是32位的,考虑到兼容性,我安装的是32位的python
python3.4安装后自带pip和setuptools,可以通过pip list查看安装了那些模块。
不过自带pip和setuptools版本都比较低,可以再次安装新版本或者安装指定版本
pip install pip==19.1.1 pip install setuptools==42.0.2
使用pip install pyinstaller 或者 easy_install pyinstaller安装pyinstaller打包程序,提示错误:
Traceback (most recent call last): File "setup.py", line 78, in <module> 'build': MyBuild, File "C:Python34libdistutilscore.py", line 109, in setup _setup_distribution = dist = klass(attrs) File "C:Python34libsite-packagessetuptoolsdist.py", line 239, in __init__ self.fetch_build_eggs(attrs.pop('setup_requires')) File "C:Python34libsite-packagessetuptoolsdist.py", line 263, in fetch_bu ild_eggs parse_requirements(requires), installer=self.fetch_build_egg File "C:Python34libsite-packagespkg_resources.py", line 576, in resolve raise VersionConflict(dist,req) # XXX put more info here pkg_resources.VersionConflict: (setuptools 2.1 (c:python34libsite-packages), Requirement.parse('setuptools>=39.2.0'))
执行pip install pyinstaller==3.4,通过指定低版本安装成功
pip list
C:Usersadmin>pip list DEPRECATION: Python 3.4 support has been deprecated. pip 19.1 will be the last one supporting it. Please upgrade your Python as Python 3.4 won't be maintained after March 2019 (cf PEP 429). Package Version -------------- --------- altgraph 0.17 future 0.18.2 macholib 1.14 pefile 2019.4.18 pip 19.1.1 PyInstaller 3.4 pywin32-ctypes 0.2.0 setuptools 42.0.2 wheel 0.33.6
上面有些内容是安装pyinstaller3.4版本时自动安装下来的依赖包,大约有7个依赖包:
altgraph 0.17 future 0.18.2 macholib 1.14 pefile 2019.4.18 PyInstaller 3.4 pywin32-ctypes 0.2.0 wheel 0.33.6
pyinstaller -v提示版本号,则pyinstaller安装成功
pyinstaller使用:
version.txt、ICO图片可以去网上下载
D:pythonworkworkspaceNmonpy-GUI-master>pyinstaller --version-file version.txt -F -i lr2.ico -w nmonpy.py 119 INFO: PyInstaller: 3.4 129 INFO: Python: 3.4.0 129 INFO: Platform: Windows-7-6.1.7601-SP1 139 INFO: wrote D:pythonworkworkspaceNmonpy-GUI-master monpy.spec 139 INFO: UPX is not available. 149 INFO: Extending PYTHONPATH with paths ['D:\pythonwork\workspace\Nmonpy-GUI-master', 'D:\pythonwork\workspace\Nmonpy-GUI-master'] 159 INFO: checking Analysis 250 INFO: checking PYZ 269 INFO: checking PKG 330 INFO: Building because D:pythonworkworkspaceNmonpy-GUI-masteruild monpy monpy.exe.manifest changed 330 INFO: Building PKG (CArchive) PKG-00.pkg 2770 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully. 2860 INFO: Bootloader c:python34libsite-packagesPyInstallerootloaderWindows-32bit unw.exe 2860 INFO: checking EXE 2870 INFO: Rebuilding EXE-00.toc because nmonpy.exe missing 2880 INFO: Building EXE from EXE-00.toc 2880 INFO: SRCPATH [('lr2.ico', None)] 2890 INFO: Updating icons from ['lr2.ico'] to C:UsersadminAppDataLocalTemp mp2i0t_x8g 2890 INFO: Writing RT_GROUP_ICON 0 resource with 20 bytes 2890 INFO: Writing RT_ICON 1 resource with 4904 bytes 2900 INFO: Appending archive to EXE D:pythonworkworkspaceNmonpy-GUI-masterdist monpy.exe 2910 INFO: Building EXE from EXE-00.toc completed successfully. D:pythonworkworkspaceNmonpy-GUI-master>