pyinstaller安装出现'NoneType' object has no attribute 'rfind'问题解决

pyinstaller出现’NoneType’ object has no attribute ‘rfind’问题解决

用pyinstaller-2.0在linux上打包一个文件,直接运行的源代码pyinstaller.py进行安装:

./pyinstaller-2.0/pyinstaller.py -F main.py

报下面的错误:

Traceback (most recent call last):
  File "./pyinstaller-2.0/pyinstaller.py", line 91, in 
    main()
  File "./pyinstaller-2.0/pyinstaller.py", line 86, in main
    run_build(opts, spec_file)
  File "./pyinstaller-2.0/pyinstaller.py", line 50, in run_build
    PyInstaller.build.main(spec_file, **opts.__dict__)
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/build.py", line 1625, in main
    build(specfile, buildpath)
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/build.py", line 1582, in build
    execfile(spec)
  File "/home/ChargerPlanning/PlanTaskImpl.spec", line 5, in 
    hookspath=None)
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/build.py", line 389, in __init__
    self.__postinit__()
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/build.py", line 315, in __postinit__
    self.assemble()
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/build.py", line 475, in assemble
    importTracker.analyze_script(script)
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/depend/imptracker.py", line 205, in analyze_script
    return self.analyze_r('__main__')
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/depend/imptracker.py", line 98, in analyze_r
    newnms = self.analyze_one(name, nm, imptyp, level)
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/depend/imptracker.py", line 159, in analyze_one
    mod = self.doimport(nm, ctx, fqname)
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/depend/imptracker.py", line 231, in doimport
    mod = parent.doimport(nm)
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/depend/modules.py", line 119, in doimport
    mod = self.subimporter.getmod(nm)
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/depend/impdirector.py", line 145, in getmod
    mod = owner.getmod(nm)
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/depend/owner.py", line 135, in getmod
    mod = self._modclass()(nm, pth, co)
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/depend/modules.py", line 83, in __init__
    self.scancode()
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/depend/modules.py", line 86, in scancode
    self.imports, self.warnings, self.binaries, allnms = scan_code(self.co)
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/depend/utils.py", line 199, in scan_code
    _, _, _, all_nested = scan_code(c, m, w, b, 1)
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/depend/utils.py", line 191, in scan_code
    ctypesb, ctypesw = scan_code_for_ctypes(co, instrs, i)
  File "/home/ChargerPlanning/pyinstaller-2.0/PyInstaller/depend/utils.py", line 279, in scan_code_for_ctypes
    if bin != os.path.basename(bin):
  File "/usr/local/lib/python2.7/posixpath.py", line 114, in basename
    i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'

在网上查了一下,有人提到可能是之前版本pyinstaller的bug,于是尝试更新最新版本pyinstaller:

pip install https://github.com/pyinstaller/pyinstaller/tarball/develop

然后再运行pyinstaller,问题解决,完美打包。

你可能感兴趣的:(Bug记录)