Python Forum
Python 3.4: the only release to create .EXE standalone without .dll
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python 3.4: the only release to create .EXE standalone without .dll
#1
Hi all,
I hope that someone disagrees the title assumption, being carried out several tests through v.3.5.1, which reaches differently the goal, as shown in this screenshot: http://imgbox.com/BFWXJGZL Namely, the executable Neper.exe works only in presence of plenty of dynamic libraries (.dll)

What have I done by downgrading to 3.4?

First of all, installing the module py2exe, that works better if called by 3.4 and not by 3.5.1 (mystery!). Look at this scheme:
C:\Users\Alfabeta>python -V
Python 3.4.0

C:\Users\Alfabeta>pip -V
pip 1.5.4 from C:\Python34\lib\site-packages (python 3.4)

C:\Users\Alfabeta>pip freeze
mpmath==1.1.0
py2exe==0.9.2.2
Secondly, doing this console command:
python compile.py mycal.py
where py's and output (mycal.exe, fully standalone) are available here: https://transfer.sh/13hM6a/samsonite_folder.rar

Thanks in advance for appreciated comments and cheers
Reply
#2
Use pyinstaller work Python 3.7 and can make one file executable(.exe).
Py2exe stopped develop at Python 3.4 and do not work for newer versions.
Show a basic run with pyinstaller in this post.
Reply
#3
snippsat wrote:
Use pyinstaller work Python 3.7 and can make one file executable(.exe).
Just done, unsuccessfully (many .dll's) with 3.5.1 version, as follows, and I have some doubts that something changes with 3.7. Better if someone else replicate my test, thank you.
C:\Users\Alfabeta>pip install pyinstaller

Collecting pyinstaller
  Downloading https://files.pythonhosted.org/packages/03/32/0e0de593f129bf1d1e77eed562496d154ef4460fd5cecfd78612ef3
9a0cc/PyInstaller-3.4.tar.gz (3.5MB)
    100% |################################| 3.5MB 1.3MB/s
  Installing build dependencies ... done
.............
.............
Successfully built pefile future
Installing collected packages: altgraph, macholib, pywin32-ctypes, future, pefile, pyinstaller
Successfully installed altgraph-0.16.1 future-0.17.1 macholib-1.11 pefile-2018.8.8 pyinstaller-3.4 pywin32-ctypes-0
.2.0

C:\Training>cd zzz

C:\Training\zzz>pyinstaller Neper.py
62 INFO: PyInstaller: 3.4
62 INFO: Python: 3.5.1
62 INFO: Platform: Windows-10-10.0.17134-SP0
62 INFO: wrote C:\Training\zzz\Neper.spec
62 INFO: UPX is not available.
78 INFO: Extending PYTHONPATH with paths
['C:\\Training\\zzz', 'C:\\Training\\zzz']
78 INFO: checking Analysis
78 INFO: Building Analysis because Analysis-00.toc is non existent
78 INFO: Initializing module dependency graph...
78 INFO: Initializing module graph hooks...
78 INFO: Analyzing base_library.zip ...
2859 INFO: running Analysis Analysis-00.toc
3515 INFO: Caching module hooks...
3530 INFO: Analyzing C:\Training\zzz\Neper.py
5585 INFO: Loading module hooks...
5585 INFO: Loading module hook "hook-encodings.py"...
5663 INFO: Loading module hook "hook-pydoc.py"...
5663 INFO: Loading module hook "hook-xml.py"...
5882 INFO: Looking for ctypes DLLs
5897 INFO: Analyzing run-time hooks ...
5897 INFO: Looking for dynamic libraries
5991 INFO: Looking for eggs
5991 INFO: Using Python library c:\users\alfabeta\appdata\local\programs\python\python35\python35.dll
5991 INFO: Found binding redirects:
[]
6009 INFO: Warnings written to C:\Training\zzz\build\Neper\warn-Neper.txt
6056 INFO: Graph cross-reference written to C:\Training\zzz\build\Neper\xref-Neper.html
6072 INFO: checking PYZ
6072 INFO: Building PYZ because PYZ-00.toc is non existent
6072 INFO: Building PYZ (ZlibArchive) C:\Training\zzz\build\Neper\PYZ-00.pyz
6587 INFO: Building PYZ (ZlibArchive) C:\Training\zzz\build\Neper\PYZ-00.pyz completed successfully.
6587 INFO: checking PKG
6587 INFO: Building PKG because PKG-00.toc is non existent
6587 INFO: Building PKG (CArchive) PKG-00.pkg
6619 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
6619 INFO: Bootloader c:\users\alfabeta\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\bootlo
ader\Windows-64bit\run.exe
6619 INFO: checking EXE
6619 INFO: Building EXE because EXE-00.toc is non existent
6619 INFO: Building EXE from EXE-00.toc
6634 INFO: Appending archive to EXE C:\Training\zzz\build\Neper\Neper.exe
6634 INFO: Building EXE from EXE-00.toc completed successfully.
6650 INFO: checking COLLECT
6650 INFO: Building COLLECT because COLLECT-00.toc is non existent
6650 INFO: Building COLLECT COLLECT-00.toc
7105 INFO: Building COLLECT COLLECT-00.toc completed successfully.
Reply
#4
Use

pyinstaller -F Neper.py
Reply
#5
Good drift, Axel.
Problem solved via pyinstaller, as shown underneath and in this screenshot http://imgbox.com/Vpl7tdbY
Thank you very much, and cheers.

C:\Training\z_folder>pyinstaller -F Neper.py
206 INFO: PyInstaller: 3.4
206 INFO: Python: 3.4.0
206 INFO: Platform: Windows-8-6.2.9200
206 INFO: wrote C:\Training\z_folder\Neper.spec
221 INFO: UPX is not available.
221 INFO: Extending PYTHONPATH with paths
['C:\\Training\\z_folder', 'C:\\Training\\z_folder']
221 INFO: checking Analysis
221 INFO: Building Analysis because Analysis-00.toc is non existent
221 INFO: Initializing module dependency graph...
221 INFO: Initializing module graph hooks...
237 INFO: Analyzing base_library.zip ...
2554 INFO: Processing pre-find module path hook   distutils
4934 INFO: running Analysis Analysis-00.toc
5356 INFO: Caching module hooks...
5371 INFO: Analyzing C:\Training\z_folder\Neper.py
8154 INFO: Loading module hooks...
8154 INFO: Loading module hook "hook-xml.py"...
8482 INFO: Loading module hook "hook-encodings.py"...
8576 INFO: Loading module hook "hook-distutils.py"...
8623 INFO: Loading module hook "hook-pydoc.py"...
8670 INFO: Looking for ctypes DLLs
8670 INFO: Analyzing run-time hooks ...
8685 INFO: Looking for dynamic libraries
8904 INFO: Looking for eggs
8904 INFO: Using Python library C:\Python34\python34.dll
8904 INFO: Found binding redirects:
[]
8920 INFO: Warnings written to C:\Training\z_folder\build\Neper\warn-Neper.txt
8982 INFO: Graph cross-reference written to C:\Training\z_folder\build\Neper\xref-Neper.html
9013 INFO: checking PYZ
9013 INFO: Building PYZ because PYZ-00.toc is non existent
9013 INFO: Building PYZ (ZlibArchive) C:\Training\z_folder\build\Neper\PYZ-00.pyz
9763 INFO: Building PYZ (ZlibArchive) C:\Training\z_folder\build\Neper\PYZ-00.pyz completed successfully.
9779 INFO: checking PKG
9795 INFO: Building PKG because PKG-00.toc is non existent
9795 INFO: Building PKG (CArchive) PKG-00.pkg
11252 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
11252 INFO: Bootloader C:\Python34\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run.exe
11252 INFO: checking EXE
11252 INFO: Building EXE because EXE-00.toc is non existent
11252 INFO: Building EXE from EXE-00.toc
11268 INFO: Appending archive to EXE C:\Training\z_folder\dist\Neper.exe
11299 INFO: Building EXE from EXE-00.toc completed successfully.
Reply
#6
samsonite Wrote:Just done, unsuccessfully (many .dll's) with 3.5.1 version, as follows, and I have some doubts that something changes with 3.7.
Had you look at my run in my previous post.
pyinstaller --onefile --console power.py
Is the same as @Axel_Erfurt postet so -F is the same as --onefile.

Upgrade your Python version,do not use Python 3.4 anymore.
Python 3.6/3.7 and pip installation under Windows
A carrot for upgrade is that you can use f-string.
>>> print(f"Sammy has {4:4} red and {16:16}! blue balloons")
Sammy has    4 red and               16! blue balloons
 
>>> # f-strings support any Python expressions inside the curly braces
>>> name = 'f-string'
>>> print(f"My cool string is called {name.upper()}.")
My cool string is called F-STRING.
 
>>> a, b = 5, 7
>>> f'{a}/{b} = {a/b:.2}'
'5/7 = 0.71'
 
>>> for word in 'f-strings are awesome'.split():
...     print(f'{word.upper():~^20}')
~~~~~F-STRINGS~~~~~~
~~~~~~~~ARE~~~~~~~~~
~~~~~~AWESOME~~~~~~~
Reply
#7
Thanks administrator!
Also in Python 3.4 pip is installed by default. By the way, in case of some troubles I'll upgrade it, as per your suggestions. Cheers
Reply
#8
Hi administrator!
In compliance with your kind advices I've erased my old ralease (3.4) and installed a new one. All works perfectly, as shown below. Thanks a lot, and cheers

Step-1: check Python version
------
C:\Users\Alfabeta>python -V
Python 3.7.2

Step-2: installing the math library (mpmath) via pip
------
C:\Users\Alfabeta>pip install mpmath
Collecting mpmath
  Downloading https://files.pythonhosted.org/packages/ca/63/3384ebb3b51af9610086b23ea976e6d27d6d97bf140a76a365bd77a
3eb32/mpmath-1.1.0.tar.gz (512kB)
    100% |████████████████████████████████| 522kB 2.2MB/s
Installing collected packages: mpmath
  Running setup.py install for mpmath ... done
Successfully installed mpmath-1.1.0
You are using pip version 18.1, however version 19.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Step-3: installing module (pyinstaller)
------
C:\Users\Alfabeta>pip install pyinstaller
Collecting pyinstaller
  Downloading https://files.pythonhosted.org/packages/03/32/0e0de593f129bf1d1e77eed562496d154ef4460fd5cecfd78612ef3
9a0cc/PyInstaller-3.4.tar.gz (3.5MB)
    100% |████████████████████████████████| 3.5MB 2.2MB/s
  Installing build dependencies ... done
Requirement already satisfied: setuptools in c:\users\alfabeta\appdata\local\programs\python\python37\lib\site-pack
ages (from pyinstaller) (40.6.2)
Collecting pefile>=2017.8.1 (from pyinstaller)
  Downloading https://files.pythonhosted.org/packages/ed/cc/157f20038a80b6a9988abc06c11a4959be8305a0d33b6d21a134127
092d4/pefile-2018.8.8.tar.gz (62kB)
    100% |████████████████████████████████| 71kB 2.3MB/s
Collecting macholib>=1.8 (from pyinstaller)
  Downloading https://files.pythonhosted.org/packages/41/f1/6d23e1c79d68e41eb592338d90a33af813f98f2b04458aaf0b86908
da2d8/macholib-1.11-py2.py3-none-any.whl
Collecting altgraph (from pyinstaller)
  Downloading https://files.pythonhosted.org/packages/0a/cc/646187eac4b797069e2e6b736f14cdef85dbe405c9bfc7803ef36e4
f62ef/altgraph-0.16.1-py2.py3-none-any.whl
Collecting pywin32-ctypes (from pyinstaller)
  Downloading https://files.pythonhosted.org/packages/9e/4b/3ab2720f1fa4b4bc924ef1932b842edf10007e4547ea8157b0b9fc7
8599a/pywin32_ctypes-0.2.0-py2.py3-none-any.whl
Collecting future (from pefile>=2017.8.1->pyinstaller)
  Downloading https://files.pythonhosted.org/packages/90/52/e20466b85000a181e1e144fd8305caf2cf475e2f9674e797b222f81
05f5f/future-0.17.1.tar.gz (829kB)
    100% |████████████████████████████████| 829kB 2.2MB/s
Installing collected packages: future, pefile, altgraph, macholib, pywin32-ctypes, pyinstaller
  Running setup.py install for future ... done
  Running setup.py install for pefile ... done
  Running setup.py install for pyinstaller ... done
Successfully installed altgraph-0.16.1 future-0.17.1 macholib-1.11 pefile-2018.8.8 pyinstaller-3.4 pywin32-ctypes-0
.2.0
You are using pip version 18.1, however version 19.0.3 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Step-3bis: updating (pip) as suggested before
---------
C:\Users\Alfabeta>python -m pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125
dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 3.0MB/s
Installing collected packages: pip
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
      Successfully uninstalled pip-18.1
Successfully installed pip-19.0.3

C:\Users\Alfabeta>pip -V
pip 19.0.3 from c:\users\alfabeta\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)


Step-4: applying pyinstaller to the code Neper.py
------
C:\Training\zoz>pyinstaller -F Neper.py
62 INFO: PyInstaller: 3.4
62 INFO: Python: 3.7.2
62 INFO: Platform: Windows-10-10.0.17134-SP0
62 INFO: wrote C:\Training\zoz\Neper.spec
62 INFO: UPX is not available.
...............
...............
8869 INFO: Appending archive to EXE C:\Training\zoz\dist\Neper.exe
8900 INFO: Building EXE from EXE-00.toc completed successfully.

Step-5: check if the standalone executable is formed 
------
 Directory di C:\Training\zoz\dist
28/02/2019  09:56         6.568.756 Neper.exe
               1 File      6.568.756 byte

Step-6: running it 
------
C:\Training\zoz\dist>Neper
2.71828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642742746639193200
3059921817413596629043572900334295260595630738132328627943490763233829880753195251019011573834187930702154089149934
8841675092447614606680822648001684774118537423454424371075390777449920695517027618386062613313845830007520449338265
6029760673711320070932870912744374704723069697720931014169283681902551510865746377211125238978442505695369677078544
9969967946864454905987931636889230098793127736178215424999229576351482208269895193668033182528869398496465105820939
2398294887933203625094431173012381970684161403970198376793206832823764648042953118023287825098194558153017567173613
3206981125099618188159304169035159888851934580727386673858942287922849989208680582574927961048419844436346324496848
7560233624827041978623209002160990235304369941849146314093431738143640546253152096183690888707016768396424378140592
... and so on!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question [SOLVED] Tiny web server as standalone executable? Winfried 0 272 Feb-09-2024, 11:48 AM
Last Post: Winfried
  Run an app in a standalone terminal and wait until it's closed glestwid 2 2,447 Aug-30-2020, 08:14 AM
Last Post: glestwid
Lightbulb Standalone application samuelbachorik 8 3,434 Aug-02-2020, 01:57 PM
Last Post: samuelbachorik
  How to get mouse coordinates on click and release OhNoSegFaultAgain 1 2,957 May-17-2019, 06:56 PM
Last Post: buran
  How to release control of file jmair 2 2,758 Oct-03-2018, 08:22 PM
Last Post: jmair
  Release kbhit Epilepsy 2 4,243 May-26-2018, 10:47 AM
Last Post: snippsat
  How to release Memory of GPU! majinbuu 1 2,582 May-11-2018, 05:06 AM
Last Post: j.crater
  Standalone interpreter? stf92 2 2,775 Mar-11-2018, 12:33 AM
Last Post: stf92
  Correct way to import from a standalone module in a different location chowder 3 18,309 Dec-16-2017, 07:44 PM
Last Post: Larz60+
  3.6.2 is latest stable release right? And "path length" Fran_3 3 3,296 Aug-01-2017, 02:04 PM
Last Post: Fran_3

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020