因為我們的測試壓力機大部分是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:\Python34\lib\distutils\core.py", line 109, in setup _setup_distribution = dist = klass(attrs) File "C:\Python34\lib\site-packages\setuptools\dist.py", line 239, in __init__ self.fetch_build_eggs(attrs.pop('setup_requires')) File "C:\Python34\lib\site-packages\setuptools\dist.py", line 263, in fetch_bu ild_eggs parse_requirements(requires), installer=self.fetch_build_egg File "C:\Python34\lib\site-packages\pkg_resources.py", line 576, in resolve raise VersionConflict(dist,req) # XXX put more info here pkg_resources.VersionConflict: (setuptools 2.1 (c:\python34\lib\site-packages), Requirement.parse('setuptools>=39.2.0'))
執行pip install pyinstaller==3.4,通過指定低版本安裝成功
pip list
C:\Users\admin>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:\pythonwork\workspace\Nmonpy-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:\pythonwork\workspace\Nmonpy-GUI-master\nmonpy.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:\pythonwork\workspace\Nmonpy-GUI-master\build\nmonpy\nmonpy.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:\python34\lib\site-packages\PyInstaller\bootloader\Windows-32bit\runw.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:\Users\admin\AppData\Local\Temp\tmp2i0t_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:\pythonwork\workspace\Nmonpy-GUI-master\dist\nmonpy.exe 2910 INFO: Building EXE from EXE-00.toc completed successfully. D:\pythonwork\workspace\Nmonpy-GUI-master>