PyInstaller Winerror3:系统无法找到指定的路径

问题描述 投票:3回答:1

我正在尝试使用以下命令使用pyinstaller创建可执行文件:

pyinstaller <script>.py

它在Linux中运行得非常好,但不知何故,这似乎不适用于Windows。

Python : 3.5

Pyinstaller : 3.4

但它不断地为系统抛出错误,找不到指定的路径:C:\ folder \ build \ scriptname

而通常在执行PyInstaller命令后创建构建文件夹。

Traceback (most recent call last): File "C:\Program Files\Python 3.5\Scripts\pyinstaller-script.py", line 11, in <module> load_entry_point('PyInstaller==3.4', 'console_scripts', 'pyinstaller')() File "c:\program files\python 3.5\lib\site-packages\PyInstaller\__main__.py", line 111, in run run_build(pyi_config, spec_file, **vars(args)) File "c:\program files\python 3.5\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "c:\program files\python 3.5\lib\site-packages\PyInstaller\building\build_main.py", line 838, in main build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build')) File "c:\program files\python 3.5\lib\site-packages\PyInstaller\building\build_main.py", line 741, in build os.makedirs(pth) File "c:\program files\python 3.5\lib\os.py", line 241, in makedirs mkdir(name, mode) FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\cms\\build\\cmstest

编辑:是的脚本工作,脚本在Win 10,Fedora 28或使用IDLE没有问题。

编辑:我得到一个.spec文件和一个空的dist文件夹

编辑:这是我的spec文件

block_cipher = None


a = Analysis(['cmsnewtest.py'],
         pathex=['C:\\cms'],
         binaries=[],
         datas=[],
         hiddenimports=[],
         hookspath=[],
         runtime_hooks=[],
         excludes=[],
         win_no_prefer_redirects=False,
         win_private_assemblies=False,
         cipher=block_cipher,
         noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
         cipher=block_cipher)
exe = EXE(pyz,
      a.scripts,
      a.binaries,
      a.zipfiles,
      a.datas,
      [],
      name='cmsnewtest',
      debug=False,
      bootloader_ignore_signals=False,
      strip=False,
      upx=True,
      runtime_tmpdir=None,
      console=True ) `
python python-3.x pip pyinstaller
1个回答
0
投票

对于Windows,请尝试以下操作。我将向您展示python 3.7的步骤。对于python 3.5是相同的方式:

  1. 在Windows上安装Python 3.7:https://www.python.org/ftp/python/3.7.0/python-3.7.0-amd64.exe
  2. 在安装过程中检查以下方框:Python install process 01 Python install process 02设置python环境变量很重要!没有这个python无法正常运行pyinstaller包!我和你一样有同样的问题。
  3. 安装后启动cmd提示符并运行以下命令:pip install pyinstaller
  4. 打开cmd promt和naivgate到.py文件并运行pyinstaller,例如: cd C:\ users \ admin \ desktop \ pythonscriptfolder \ pyinstaller somepythonscript.py
© www.soinside.com 2019 - 2024. All rights reserved.