获取IOError:[Errno 21]尝试运行PyInstaller时出现目录错误

时间:2016-03-20 02:08:51

标签: python ubuntu pyinstaller

我正在尝试使用PyInstaller为我的Python脚本创建一个可执行文件。我在终端跑...

  

pyinstaller --onefile --windowed ./lab_attendant_emailer.py

从python文件所在的目录。它开始运行一段但返回此错误。

12 INFO: PyInstaller: 3.1.1
12 INFO: Python: 2.7.6
12 INFO: Platform: Linux-3.16.0-67-generic-x86_64-with-Ubuntu-14.04-trusty
12 INFO: wrote /home/carsnwd/PycharmProjects/labattendantemailer/lab_attendant_emailer.spec
14 INFO: UPX is not available.
15 INFO: Extending PYTHONPATH with paths
['/home/carsnwd/PycharmProjects/labattendantemailer',
 '/home/carsnwd/PycharmProjects/labattendantemailer']
15 INFO: checking Analysis
21 INFO: checking PYZ
22 INFO: checking PKG
25 INFO: Bootloader /usr/local/lib/python2.7/dist-packages/PyInstaller/bootloader/Linux-64bit/run
25 INFO: checking EXE
25 INFO: Building because name changed
25 INFO: Building EXE from out00-EXE.toc
Traceback (most recent call last):
  File "/usr/local/bin/pyinstaller", line 9, in <module>
    load_entry_point('PyInstaller==3.1.1', 'console_scripts', 'pyinstaller')()
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/__main__.py", line 90, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/__main__.py", line 46, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 755, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/build_main.py", line 701, in build
    exec(text, spec_namespace)
  File "<string>", line 28, in <module>
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/api.py", line 498, in __init__
    self.__postinit__()
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/datastruct.py", line 183, in __postinit__
    self.assemble()
  File "/usr/local/lib/python2.7/dist-packages/PyInstaller/building/api.py", line 575, in assemble
    outf = open(self.name, 'wb')
IOError: [Errno 21] Is a directory: '/home/carsnwd/PycharmProjects/labattendantemailer/dist/lab_attendant_emailer'

对我做错的任何帮助?

1 个答案:

答案 0 :(得分:1)

您可能会运行pyinstaller一次,并创建dist目录。

当您尝试再次重新运行时,它具有使用上一个命令创建的所有目录结构。请清理您的目录,然后重新运行pyinstaller,这将有效。