Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
hi guys,

i want to convert a file - - into a - try5.exe

when i use pyinstaller in the terminal - it only creates a file called try5.spec, and a sub-directory called 'build' where within it a directory called try5 and within it a .zip file called

but nowhere to be found a try5.exe

you have an idea how to fix this ?

.exe shall be in dist folder.
Here i run,and i use cmder.
# File used,<more> in cmd
λ cat
print('hello world')
input('Press Enter to exit')

# Make
λ pyinstaller --onefile
140 INFO: PyInstaller: 3.4
140 INFO: Python: 3.7.3
141 INFO: Platform: Windows-10-10.0.18362-SP0
142 INFO: wrote C:\code\hello.spec
276 INFO: UPX is not available.
278 INFO: Extending PYTHONPATH with paths
['C:\\code', 'C:\\code']
278 INFO: checking Analysis
345 INFO: checking PYZ
386 INFO: checking PKG
397 INFO: Bootloader c:\python37\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run.exe
397 INFO: checking EXE

# cd to dist
λ cd dist

# List files,<dir> i cmd
λ ls

# Run .exe
λ hello
hello world
Press Enter to exit

there is no such folder under the dist directory, there is only 'hello world' folder there, from a previous conversion (which i think succeeded, but i don't remember how it succeeded back then).

and by the way, it's under linux terminal which i try to run it
(May-23-2020, 02:40 PM)astral_travel Wrote: and by the way, it's under linux terminal which i try to run it
The dist folder should be there,but it it dos not create .exe under Linux,just hello which can be executed.
# File used
root@kali-tom:~/Documents# cat
print('hello world')
input('Press Enter to exit')

# Make
root@kali-tom:~/Documents# pyinstaller --onefile
39 INFO: PyInstaller: 3.6
39 INFO: Python: 3.7.5
40 INFO: Platform: Linux-5.3.0-kali2-amd64-x86_64-with-debian-kali-rolling
40 INFO: wrote /root/Documents/hello.spec
43 INFO: UPX is available.
44 INFO: Extending PYTHONPATH with paths
['/root/Documents', '/root/Documents']
45 INFO: checking Analysis
49 INFO: checking PYZ
51 INFO: checking PKG
52 INFO: Bootloader /usr/local/lib/python3.7/dist-packages/PyInstaller/bootloader/Linux-64bit/run
52 INFO: checking EXE

# cd to dist
root@kali-tom:~/Documents# cd dist

# List files
root@kali-tom:~/Documents/dist# ls

# Run
root@kali-tom:~/Documents/dist# ./hello
hello world
Press Enter to exit

okay, so when i move the file onto windows (in another computer) - how can i run it there ? will it show it as .exe ?

the whole purpose of this is to run the program under windows (probably in cmd)

this is the output of when i try to run it:

tal@tal-HP-Notebook:~/Documents/python_folder$ pyinstaller --onefile 48 INFO: PyInstaller: 3.6 48 INFO: Python: 3.7.2 49 INFO: Platform: Linux-4.4.0-178-generic-x86_64-with-debian-stretch-sid 50 INFO: wrote /home/tal/Documents/python_folder/try5.spec 52 INFO: UPX is not available. 53 INFO: Extending PYTHONPATH with paths ['/home/tal/Documents/python_folder', '/home/tal/Documents/python_folder'] 54 INFO: checking Analysis 54 INFO: Building Analysis because Analysis-00.toc is non existent 54 INFO: Initializing module dependency graph... 56 INFO: Caching module graph hooks... 61 INFO: Analyzing ... 4007 INFO: Caching module dependency graph... 4143 INFO: running Analysis Analysis-00.toc 4158 INFO: Analyzing /home/tal/Documents/python_folder/ 4161 INFO: Processing module hooks... 4161 INFO: Loading module hook ""... 4452 INFO: Loading module hook ""... 4452 INFO: Loading module hook ""... 4525 INFO: Looking for ctypes DLLs 4526 INFO: Analyzing run-time hooks ... 4533 INFO: Looking for dynamic libraries 4957 INFO: Looking for eggs 4958 INFO: Python library not in binary dependencies. Doing additional searching... Traceback (most recent call last): File "/home/tal/.local/bin/pyinstaller", line 8, in <module> sys.exit(run()) File "/home/tal/.local/lib/python3.7/site-packages/PyInstaller/", line 114, in run run_build(pyi_config, spec_file, **vars(args)) File "/home/tal/.local/lib/python3.7/site-packages/PyInstaller/", line 65, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "/home/tal/.local/lib/python3.7/site-packages/PyInstaller/building/", line 734, in main build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build')) File "/home/tal/.local/lib/python3.7/site-packages/PyInstaller/building/", line 681, in build exec(code, spec_namespace) File "/home/tal/Documents/python_folder/try5.spec", line 17, in <module> noarchive=False) File "/home/tal/.local/lib/python3.7/site-packages/PyInstaller/building/", line 244, in __init__ self.__postinit__() File "/home/tal/.local/lib/python3.7/site-packages/PyInstaller/building/", line 160, in __postinit__ self.assemble() File "/home/tal/.local/lib/python3.7/site-packages/PyInstaller/building/", line 478, in assemble self._check_python_library(self.binaries) File "/home/tal/.local/lib/python3.7/site-packages/PyInstaller/building/", line 568, in _check_python_library python_lib = bindepend.get_python_library_path() File "/home/tal/.local/lib/python3.7/site-packages/PyInstaller/depend/", line 945, in get_python_library_path raise IOError(msg) OSError: Python library not found:,,, This would mean your Python installation doesn't come with proper library files. This usually happens by missing development package, or unsuitable build parameters of Python installation. * On Debian/Ubuntu, you would need to install Python development packages * apt-get install python3-dev * apt-get install python-dev * If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin) tal@tal-HP-Notebook:~/Documents/python_folder$
The Python version you use now is missing some libraries that Pyinstaller need.
Can try this as a fix without having to rebuild.
sudo apt-get install libpython3.7-dev
pyinstaller Wrote:PyInstaller is tested against Windows, Mac OS X, and GNU/Linux. However,
it is not a cross-compiler: to make a Windows app you run PyInstaller in Windows;
to make a GNU/Linux app you run it in GNU/Linux, etc.
So need to build on each platform.
So now the have build on two platforms.
Could make it like this so it use right executable on OS it's on.
import platform
import subprocess

if platform.system() == 'Windows':'hello.exe')
elif platform.system() == 'Linux':'./hello')
okay, got it

thank you for the response

ah, but regarding using pyinstaller,
when i try to install the packages it gives me the following output:

tal@tal-HP-Notebook:~/Documents/python_folder/dist/hello_world$ sudo apt-get install libpython3.7-dev [sudo] password for tal: Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package libpython3.7-dev E: Couldn't find any package by glob 'libpython3.7-dev' E: Couldn't find any package by regex 'libpython3.7-dev' tal@tal-HP-Notebook:~/Documents/python_folder/dist/hello_world$
Try update first look at Install libpython3.7-dev.
okay, the first command did did some work, but the second one i copied and paste gave me the same ouput
The problem for you is that when they build Python on this Distro they did not include Python shared library.
Python library not found:,,,
sudo apt-get install python3-dev
If that not work you most search for solution,there are several suggestion out there.

I use pyenv Simple Python Version Management when need to install a new Python version or switch.
So also here most include shared library's.
Let say i want to use Python 3.8.3 and use pyinstaller.
# Install with --enable-shared
tom@tom-VirtualBox:~$ PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.8.3
Downloading Python-3.8.3.tar.xz...
Installing Python-3.8.3...
Installed Python-3.8.3 to /home/tom/.pyenv/versions/3.8.3

# Set as system wide version
tom@tom-VirtualBox:~$ pyenv global 3.8.3

# Install pyinstaller
tom@tom-VirtualBox:~$ pip install pyinstaller

# Make
tom@tom-VirtualBox:~$ pyinstaller --onefile
61 INFO: PyInstaller: 3.6
61 INFO: Python: 3.8.3
66 INFO: Platform: Linux-4.15.0-32-generic-x86_64-with-glibc2.2.5
67 INFO: wrote /home/tom/hello.spec
17781 INFO: Appending archive to ELF section in EXE /home/tom/dist/hello
17832 INFO: Building EXE from EXE-00.toc completed successfully.

# Cd to dist and run
tom@tom-VirtualBox:~$ cd dist

tom@tom-VirtualBox:~/dist$ ls

tom@tom-VirtualBox:~/dist$ ./hello
hello world
Press Entert to quit
You can of course also do it as shown over if you setup pyenv Wink

Top Page

Forum Jump:

Users browsing this thread: 1 Guest(s)