【问题标题】:PyInstaller Winerror3 : System cannot find path specifiedPyInstaller Winerror3:系统找不到指定的路径
【发布时间】:2019-02-28 17:13:46
【问题描述】:

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

pyinstaller <script>.py

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

Python : 3.5

Pyinstaller : 3.4

但它不断抛出错误,系统找不到指定的路径: C:\文件夹\构建\脚本名

而 build 文件夹通常是在 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 文件夹

编辑:这是我的规范文件

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】:

对于 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环境变量很重要!没有这个 python 就无法正确运行像 pyinstaller 这样的包!我和你有同样的问题。

  3. 安装后启动 cmd 提示符并运行以下命令: pip install pyinstaller

  4. 打开 cmd promt 并导航到 .py 文件并运行 pyinstaller,例如:

    cd C:\users\admin\desktop\pythonscriptfolder\

    pyinstaller somepythonscript.py

【讨论】:

    猜你喜欢
    • 2019-12-22
    • 1970-01-01
    • 1970-01-01
    • 2011-02-23
    • 2018-12-12
    • 2016-04-23
    • 2017-01-04
    • 2014-04-24
    相关资源
    最近更新 更多