Merge pull request #2225 from nicozanf/pyinstaller

Full docs for obtaining Win and Mac binaries with PyInstaller
This commit is contained in:
mdipierro
2019-10-20 21:35:47 -07:00
committed by GitHub
4 changed files with 3730 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
## MacOS binaries
The MacOS binaries contain Python 3.7.3 (or 2.7.16) 64 bit with all the needed modules and the web2py in the specified version:
you don't need anything else to run them on MacOS! After uncompressing the zip file, you just need to click on the web2py icon inside.
They were produced on MacOS Sierra 10.12.6 + security update 2019.001.
## Full MacOS build recipe
1. grab and install the official Python program: we've got version 3.7.3 or 2.7.16 (64 bit). If you've chosen python 2, change pip3
with pip, and python3 with python in the following instructions...
2. Open a terminal, update tools with:
"python3 -m pip install --upgrade pip"
"pip3 install --upgrade setuptools"
3. install PyInstaller with:
sudo -H pip3 install pyinstaller (we've got PyInstaller-3.4 )
4. additional (but not required) packages:
(only for python 2: install Homebrew from https://brew.sh/#install , then 'brew install unixodbc' )
pip3 install psycopg2-binary = psycopg2-2.7.7
pip3 install pyodbc = pyodbc-4.0.26-cp37-cp37m
pip3 install python-ldap (on the windows message, accept to install the "Command line developer tools"). Rerun:
pip3 install python-ldap
5. grab latest web2py source from https://mdipierro.pythonanywhere.com/examples/static/web2py_src.zip
(you need at least 2.18.3 for needed changes in gluon\admin.py). Open it to uncompress, in this example on Desktop/web2py
6. take the file build_web2py.py and web2py.mac.spec from this folder and place it on the Desktop/web2py folder
7. edit the file /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/hooks/hook-_tkinter.py
and change one of its line according to https://github.com/pyinstaller/pyinstaller/pull/3830
8. (optional, for having a full working interactive shell) change the fake site.py module included within the PyInstaller installation
with the content of the files web2py.site_37.py or web2py.site_27.py from this folder - see comments inside these files for details
9. open a terminal, goto Desktop/web2py and run:
python3 build_web2py.py
10. if everything is fine, you'll obtain web2py_macos.zip on the Desktop/web2py folder. Inside it, there is the web2py program with
both the CMD version and the APP version.
## Gothca
Unfortunately, the APP version is still not working - see https://github.com/pyinstaller/pyinstaller/issues/3820 .

View File

@@ -0,0 +1,47 @@
## Windows binaries
The windows binaries contain Python 64 bit version 3.7.3 or 2.7.16 with all the needed modules and the web2py in the specified version.
You don't need anything else to run them on Windows.
At least on Windows 7, if you get an error stating that "api-ms-win-crt-runtime-l1-1-0.dll is missing" you have only to install the
free and official "Visual C++ Redistributable for Visual Studio" as described later
## Full Windows build recipe
1. get a clean Windows 10 (Windows 10 Professional English build 1809 64 bit, under Virtualbox in our case)
2. grab and install the official Python program: we've got version 3.7.3 or 2.7.16, 64 bit
(https://www.python.org/ftp/python/3.7.2/python-3.7.2-amd64.exe ) + select "add Python 3.7 to PATH" during its setup if Python 3.
For Python 2 you need to manually add the folders for python27 and python27\Scripts to the system path.
3. update tools with
"python -m pip install --upgrade pip"
"pip install --upgrade setuptools"
4. download and install python-win32, which is needed for web2py to work with all features enabled
(https://github.com/mhammond/pywin32/releases/download/b224/pywin32-224.win-amd64-py3.7.exe)
5. grab latest web2py source from https://mdipierro.pythonanywhere.com/examples/static/web2py_src.zip (you need at least 2.18.3 for
needed changes in gluon\admin.py). Unzip it in a dedicated folder, in this example C:\web2py - so that you have
C:\web2py\web2py.py inside)
6. install PyInstaller with:
pip install pyinstaller (we've got PyInstaller-3.4.tar.gz )
7. download and install the free Microsoft Visual C++ Redistributable per Visual Studio 2017, 64 bit version, from
https://aka.ms/vs/15/release/vc_redist.x64.exe
8. additional (but not required) packages to work better in the Windows world:
pip install psycopg2 = psycopg2-2.7.7-cp37-cp37m-win_amd64.whl
pip install pyodbc = pyodbc-4.0.26-cp37-cp37m-win_amd64.whl
download the file python_ldap-3.1.0-cp37-cp37m-win_amd64.whl from https://www.lfd.uci.edu/~gohlke/pythonlibs/ and install it from that
folder with the command 'pip install python_ldap-3.1.0-cp37-cp37m-win_amd64.whl'
9. copy build_web2py.py, web2py.win.spec and web2py.win_no_console.spec from this folder to C:\web2py\
10. (only for python 2) - due to a PyInstaller bug, you need to manually change the file gluon\rocket.py, line 26, from IS_JYTHON
= platform.system() == 'Java' to IS_JYTHON = False
11. (optional, for having a full working interactive shell) change the fake site.py module included within the PyInstaller installation
with the content of the files web2py.site_37.py or web2py.site_27.py from this folder - see comments inside these files for details
12. open a CMD and go to C:\web2py. Run:
python build_web2py.py
If everything goes fine, you'll obtain the 64 bit binary build zipped as C:\web2py\web2py_win.zip.
If you try to run it in a 32 bit Windows system, you'll correctly get a 'web2py.exe not a valid Win32 application' error message.
## Gothca:
- at least on Windows 7, you can get an error stating that "api-ms-win-crt-runtime-l1-1-0.dll is missing". You can easily resolve it by
installing "Visual C++ Redistributable for Visual Studio" described earlier

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff