-5

i'm trying to use pyinstaller on Kali Linux to compile a python program but when i run it i have some problem:

root@kali:/usr/bin# ./pyinstaller ~/Desktop/neighbourhood.py 
14 INFO: wrote /usr/share/pyinstaller/neighbourhood/neighbourhood.spec
44 INFO: UPX is available.
520 INFO: checking Analysis
520 INFO: building Analysis because out00-Analysis.toc non existent
522 INFO: running Analysis out00-Analysis.toc
575 INFO: Analyzing /usr/share/pyinstaller/support/_pyi_bootstrap.py
1022 INFO: Analyzing /usr/share/pyinstaller/PyInstaller/loader/archive.py
1058 INFO: Analyzing /usr/share/pyinstaller/PyInstaller/loader/carchive.py
1107 INFO: Analyzing /usr/share/pyinstaller/PyInstaller/loader/iu.py
1121 INFO: Analyzing /root/Desktop/neighbourhood.py
2964 INFO: checking Tree
2964 INFO: building because out00-Tree.toc missing or bad
2964 INFO: building Tree out00-Tree.toc
2996 INFO: checking Tree
2996 INFO: building because out01-Tree.toc missing or bad
2996 INFO: building Tree out01-Tree.toc
Traceback (most recent call last):
  File "./pyinstaller.py", line 91, in <module>
    main()
  File "./pyinstaller.py", line 86, in main
    run_build(opts, spec_file)
  File "./pyinstaller.py", line 50, in run_build
    PyInstaller.build.main(spec_file, **opts.__dict__)
  File "/usr/share/pyinstaller/PyInstaller/build.py", line 1625, in main
    build(specfile, buildpath)
  File "/usr/share/pyinstaller/PyInstaller/build.py", line 1582, in build
    execfile(spec)
  File "/usr/share/pyinstaller/neighbourhood/neighbourhood.spec", line 5, in <module>
    hookspath=None)
  File "/usr/share/pyinstaller/PyInstaller/build.py", line 389, in __init__
    self.__postinit__()
  File "/usr/share/pyinstaller/PyInstaller/build.py", line 315, in __postinit__
    self.assemble()
  File "/usr/share/pyinstaller/PyInstaller/build.py", line 475, in assemble
    importTracker.analyze_script(script)
  File "/usr/share/pyinstaller/PyInstaller/depend/imptracker.py", line 205, in analyze_script
    return self.analyze_r('__main__')
  File "/usr/share/pyinstaller/PyInstaller/depend/imptracker.py", line 98, in analyze_r
    newnms = self.analyze_one(name, nm, imptyp, level)
  File "/usr/share/pyinstaller/PyInstaller/depend/imptracker.py", line 159, in analyze_one
    mod = self.doimport(nm, ctx, fqname)
  File "/usr/share/pyinstaller/PyInstaller/depend/imptracker.py", line 256, in doimport
    hooks = __import__('PyInstaller.hooks', globals(), locals(), [hookmodnm])
TypeError: Item in ``from list'' not a string

I don't know if this is problem but i have pyinstaller in a lot of folders.

root@kali:~# whereis pyinstaller
pyinstaller: /usr/bin/pyinstaller /usr/local/bin/pyinstaller /usr/share/pyinstaller

I follow a tutorial on youtube and it runs this command:

./pyinstaller setup.py

but i can't find setup.py in pyinstaller's folder . If if run pyinstaller with out dot slash i got this:

root@kali:~# pyinstaller No handlers could be found for logger "PyInstaller.utils.misc"

Anyone know how to fix it? Thanks You!

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
Syrion
  • 199
  • 1
  • 2
  • 12

1 Answers1

2

If whereis shows you paths, then pyinstaller is in your PATH. That means you don't need a dot slash prefix to run pyinstaller. Run pyinstaller --version to see that it's working without ./ prefix.

Take into account that the output directory will be created in the directory where you are currently in. In you case /usr/bin, which is kind of strange choice. Also, I don't quite get why are you using root user for this.

So, it would be better if you first change directory to the one, where your script is:

$ cd ~/Desktop/neighbourhood.py

And then compile the program:

$ pyinstaller neighbourhood.py

Regarding the error you've encountered. It's hard to say what's happening. Probably, this is a problem with module name dynamically passed to python's import. See more information here. If you have a choice between python 2 and python 3, use the latter to avoid this kind of problem.

The last but not least: I strongly recommend you using official docs instead of youtube tutorials.

Community
  • 1
  • 1
vrs
  • 1,922
  • 16
  • 23
  • When i run it with out dot slash i got this: root@kali:~# pyinstaller No handlers could be found for logger "PyInstaller.utils.misc" – Syrion Jan 10 '16 at 00:38
  • @Syrion It looks like you are using an old version of `pyinstaller`. In older versions there was a bug, that prevented using `pyinstaller` under `root` (see [this discussion](https://github.com/pyinstaller/pyinstaller/issues/1564)). Check your version with `./pyinstaller --version`. Current stable version is 3.1. I don't how did you installed `pyinstaller`, but suggest you to upgrade. If you had installed it with `pip`, then upgrade it with `pip install --upgrade pyinstaller` (See details [here](https://pythonhosted.org/PyInstaller/#how-to-install-pyinstaller)) – vrs Jan 10 '16 at 11:01