How To Install python 3.4 3.5 and up on Linux with wine - Working Solution

This is sure simple if you follow the guide but it took a lot of hacking around to make this work on Debian/Ubuntu!
Now before you ask why bother running wine and python, the reason is because Python executables are NOT cross-platform.  If you run pyinstaller in Linux, that binary will only run on Linux and the same if you do it in Windows.  So it is preferable if you have a single environment that you can create Linux and Windows binaries from rather than running 2 separate ones.  The best way to do that is wine if you have the patience to make it work!

python 3.5 and up doesn't install properly in wine 2.4.  It doesn't even show the install button
#but it seems OK if you installed vcrun2015 and just click in the middle of the installer it seems to complete (if it doesn't complete and gives an error this is because you didn't install vcrun2015 with winetricks).

#1 Use Wine 2.4

apt install add-apt-repository
add-apt-repository ppa:wine/wine-builds
apt install --install-recommends winehq-devel


#2 Use winetricks (a newer one that what is available in the repo)
wget  https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
./winetricks -q win10
./winetricks vcrun2015


#how to install like pip

wine python -m pip install pyinstaller

 


Some of the hacking around I did to figure this out: :)

 

err:module:import_dll Library api-ms-win-crt-runtime-l1-1-0.dll (which is needed by L"Z:\\root\\VCRUNTIME140.dll") not found
apt install winetricks
winetricks vcrun2015

winetricks vcrun2015
------------------------------------------------------
You are using a 64-bit WINEPREFIX. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
Unknown arg vcrun2015
Usage: /usr/bin/winetricks [options] [command|verb|path-to-verb] ...
Executes given verbs.  Each verb installs an application or changes a setting.

##############


wget  https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks

bash winetricks vcrun2015
------------------------------------------------------
Running Wine/winetricks as root is highly discouraged. See https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F
------------------------------------------------------
------------------------------------------------------
Your version of wine 1.6.2 is no longer supported upstream. You should upgrade to 4.x
------------------------------------------------------
^C^C------------------------------------------------------
WINEPREFIX INFO:
Drive C: total 24
drwxr-xr-x  6 root root 4096 Mar 25 00:29 .
drwxr-xr-x  4 root root 4096 Mar 25 14:56 ..
drwxr-xr-x  4 root root 4096 Mar 25 00:28 Program Files
drwxr-xr-x  4 root root 4096 Mar 25 00:29 Program Files (x86)
drwxr-xr-x  4 root root 4096 Mar 25 00:28 users
drwxr-xr-x 13 root root 4096 Mar 25 14:54 windows

Registry info:
/root/.wine/system.reg:#arch=win64
/root/.wine/user.reg:#arch=win64
/root/.wine/userdef.reg:#arch=win64
------------------------------------------------------
cat: /tmp/winetricks.82XQNcAN/early_wine.err.txt: No such file or directory
------------------------------------------------------
wine cmd.exe /c echo '%ProgramFiles%' returned empty string, error message ""
------------------------------------------------------




root@geekspython:~# bash winetricks vcrun2015
------------------------------------------------------
Running Wine/winetricks as root is highly discouraged. See https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F
------------------------------------------------------
------------------------------------------------------
Your version of wine 1.6.2 is no longer supported upstream. You should upgrade to 4.x
------------------------------------------------------
------------------------------------------------------
You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
Using winetricks 20191224-next - sha256sum: 3a11b9c07e2d7f5b6c21a5e7ef35c70cbc9344bd9a8e068d74b34793dfee6484 with wine-1.6.2 and WINEARCH=win64
Executing w_do_call vcrun2015
------------------------------------------------------
You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
Executing load_vcrun2015
Executing mkdir -p /root/.cache/winetricks/vcrun2015
Executing cd /root/.cache/winetricks/vcrun2015
Downloading https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe to /root/.cache/winetricks/vcrun2015
--2020-03-25 14:57:45--  https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe
Resolving download.microsoft.com (download.microsoft.com)... 104.88.156.140, 2001:4958:304:288::e59, 2001:4958:304:290::e59
Connecting to download.microsoft.com (download.microsoft.com)|104.88.156.140|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13767776 (13M) [application/octet-stream]
Saving to: 'vc_redist.x86.exe'

vc_redist.x86.exe                                           100%[=========================================================================================================================================>]  13.13M  11.2MB/s    in 1.2s   

2020-03-25 14:57:46 (11.2 MB/s) - 'vc_redist.x86.exe' saved [13767776/13767776]

Executing cd /root
------------------------------------------------------
Working around wine bug 37781
------------------------------------------------------
------------------------------------------------------
This may fail in non-XP mode, see https://bugs.winehq.org/show_bug.cgi?id=37781
------------------------------------------------------
Using native,builtin override for following DLLs: api-ms-win-crt-private-l1-1-0 api-ms-win-crt-conio-l1-1-0 api-ms-win-crt-heap-l1-1-0 api-ms-win-crt-locale-l1-1-0 api-ms-win-crt-math-l1-1-0 api-ms-win-crt-runtime-l1-1-0 api-ms-win-crt-stdio-l1-1-0 api-ms-win-crt-time-l1-1-0 atl140 concrt140 msvcp140 msvcr140 ucrtbase vcomp140 vcruntime140
Executing wine regedit C:\windows\Temp\override-dll.reg
Executing wine64 regedit C:\windows\Temp\override-dll.reg
ADD - HKLM\System\CurrentControlSet\Control\ProductOptions ProductType 0 (null) WinNT 1
The operation completed successfully
Setting Windows version to winxp
Executing wine regedit C:\windows\Temp\set-winver.reg
Executing wine64 regedit C:\windows\Temp\set-winver.reg
------------------------------------------------------
Running /usr/bin/wineserver -w. This will hang until all wine processes in prefix=/root/.wine terminate
------------------------------------------------------
Executing cd /root/.cache/winetricks/vcrun2015
Executing wine vc_redist.x86.exe
fixme:heap:HeapSetInformation (nil) 1 (nil) 0
fixme:heap:HeapSetInformation (nil) 1 (nil) 0
fixme:ntdll:NtQueryInformationToken QueryInformationToken( ..., TokenElevation, ...) semi-stub
err:ole:CoInitializeEx Attempt to change threading model of this apartment from multi-threaded to apartment threaded
fixme:heap:HeapSetInformation (nil) 1 (nil) 0
fixme:heap:HeapSetInformation (nil) 1 (nil) 0
fixme:ntdll:NtQueryInformationToken QueryInformationToken( ..., TokenElevation, ...) semi-stub
err:ole:CoInitializeEx Attempt to change threading model of this apartment from multi-threaded to apartment threaded
fixme:advapi:DecryptFileW (L"C:\\users\\root\\Temp\\{74d0e5db-b326-4dae-a6b2-445b9de1836e}\\", 00000000): stub


#

./winetricks vcrun2015
------------------------------------------------------
Running Wine/winetricks as root is highly discouraged. See https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F
------------------------------------------------------
------------------------------------------------------
Your version of wine 1.6.2 is no longer supported upstream. You should upgrade to 4.x
------------------------------------------------------
------------------------------------------------------
You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
Using winetricks 20191224-next - sha256sum: 3a11b9c07e2d7f5b6c21a5e7ef35c70cbc9344bd9a8e068d74b34793dfee6484 with wine-1.6.2 and WINEARCH=win64
Executing w_do_call vcrun2015
------------------------------------------------------
You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
Executing load_vcrun2015
------------------------------------------------------
Working around wine bug 37781
------------------------------------------------------
------------------------------------------------------
This may fail in non-XP mode, see https://bugs.winehq.org/show_bug.cgi?id=37781
------------------------------------------------------
Using native,builtin override for following DLLs: api-ms-win-crt-private-l1-1-0 api-ms-win-crt-conio-l1-1-0 api-ms-win-crt-heap-l1-1-0 api-ms-win-crt-locale-l1-1-0 api-ms-win-crt-math-l1-1-0 api-ms-win-crt-runtime-l1-1-0 api-ms-win-crt-stdio-l1-1-0 api-ms-win-crt-time-l1-1-0 atl140 concrt140 msvcp140 msvcr140 ucrtbase vcomp140 vcruntime140
Executing wine regedit C:\windows\Temp\override-dll.reg
Executing wine64 regedit C:\windows\Temp\override-dll.reg
ADD - HKLM\System\CurrentControlSet\Control\ProductOptions ProductType 0 (null) WinNT 1
The operation completed successfully
Setting Windows version to winxp
Executing wine regedit C:\windows\Temp\set-winver.reg
Executing wine64 regedit C:\windows\Temp\set-winver.reg
------------------------------------------------------
Running /usr/bin/wineserver -w. This will hang until all wine processes in prefix=/root/.wine terminate
------------------------------------------------------
Executing cd /root/.cache/winetricks/vcrun2015
Executing wine vc_redist.x86.exe
fixme:heap:HeapSetInformation (nil) 1 (nil) 0
fixme:heap:HeapSetInformation (nil) 1 (nil) 0
fixme:ntdll:NtQueryInformationToken QueryInformationToken( ..., TokenElevation, ...) semi-stub
err:ole:CoInitializeEx Attempt to change threading model of this apartment from multi-threaded to apartment threaded
fixme:heap:HeapSetInformation (nil) 1 (nil) 0
fixme:heap:HeapSetInformation (nil) 1 (nil) 0
fixme:ntdll:NtQueryInformationToken QueryInformationToken( ..., TokenElevation, ...) semi-stub
err:ole:CoInitializeEx Attempt to change threading model of this apartment from multi-threaded to apartment threaded
fixme:advapi:DecryptFileW (L"C:\\users\\root\\Temp\\{74d0e5db-b326-4dae-a6b2-445b9de1836e}\\", 00000000): stub
------------------------------------------------------
Note: command wine vc_redist.x86.exe returned status 109. Aborting.
------------------------------------------------------


WINEPREFIX=$HOME/.wine-msxml-test WINEARCH=win32 ./winetricks -q vcrun2015


apt install software-properties-common
add-apt-repository ppa:wine/wine-builds
apt update
apt install --install-recommends winehq-devel

WINEPREFIX=$HOME/.wine-msxml-test WINEARCH=win32 ./winetricks -q vcrun2015
------------------------------------------------------
Running Wine/winetricks as root is highly discouraged. See https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F
------------------------------------------------------
------------------------------------------------------
Your version of wine 2.4 is no longer supported upstream. You should upgrade to 4.x
------------------------------------------------------
Using winetricks 20191224-next - sha256sum: 3a11b9c07e2d7f5b6c21a5e7ef35c70cbc9344bd9a8e068d74b34793dfee6484 with wine-2.4 and WINEARCH=win32
Executing w_do_call vcrun2015
Executing load_vcrun2015
------------------------------------------------------
Working around wine bug 37781
------------------------------------------------------
------------------------------------------------------
This may fail in non-XP mode, see https://bugs.winehq.org/show_bug.cgi?id=37781
------------------------------------------------------
Using native,builtin override for following DLLs: api-ms-win-crt-private-l1-1-0 api-ms-win-crt-conio-l1-1-0 api-ms-win-crt-heap-l1-1-0 api-ms-win-crt-locale-l1-1-0 api-ms-win-crt-math-l1-1-0 api-ms-win-crt-runtime-l1-1-0 api-ms-win-crt-stdio-l1-1-0 api-ms-win-crt-time-l1-1-0 atl140 concrt140 msvcp140 msvcr140 ucrtbase vcomp140 vcruntime140
Executing wine regedit /S C:\windows\Temp\override-dll.reg
Setting Windows version to winxp
Executing wine regedit /S C:\windows\Temp\set-winver.reg
------------------------------------------------------
Running /usr/bin/wineserver -w. This will hang until all wine processes in prefix=/root/.wine-msxml-test terminate
------------------------------------------------------
Executing cd /root/.cache/winetricks/vcrun2015
Executing wine vc_redist.x86.exe /q
fixme:heap:RtlSetHeapInformation (nil) 1 (nil) 0 stub
fixme:heap:RtlSetHeapInformation (nil) 1 (nil) 0 stub
fixme:ntdll:NtQueryInformationToken QueryInformationToken( ..., TokenElevation, ...) semi-stub
err:ole:CoInitializeEx Attempt to change threading model of this apartment from multi-threaded to apartment threaded
fixme:heap:RtlSetHeapInformation (nil) 1 (nil) 0 stub
fixme:heap:RtlSetHeapInformation (nil) 1 (nil) 0 stub
fixme:ntdll:NtQueryInformationToken QueryInformationToken( ..., TokenElevation, ...) semi-stub
err:ole:CoInitializeEx Attempt to change threading model of this apartment from multi-threaded to apartment threaded
fixme:advapi:DecryptFileW (L"C:\\users\\root\\Temp\\{74d0e5db-b326-4dae-a6b2-445b9de1836e}\\", 00000000): stub
fixme:shell:SHAutoComplete stub
fixme:advapi:DecryptFileW (L"C:\\users\\root\\Temp\\{74d0e5db-b326-4dae-a6b2-445b9de1836e}\\", 00000000): stub
fixme:wuapi:automatic_updates_Pause
fixme:ntdll:NtLockFile I/O completion on lock not implemented yet
fixme:wuapi:automatic_updates_Resume


wine python.exe -m pip install pyinstaller
fixme:module:load_library unsupported flag(s) used (flags: 0x00000800)
fixme:module:load_library unsupported flag(s) used (flags: 0x00000800)
fixme:module:load_library unsupported flag(s) used (flags: 0x00000800)
fixme:ntdll:EtwEventRegister ({5eec90ab-c022-44b2-a5dd-fd716a222a15}, 0x100027f0, 0x10010030, 0x10010048) stub.
fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 0x10002560, 43) stub
fixme:msvcrt:_configure_wide_argv (1) stub
fixme:msvcrt:_initialize_wide_environment stub
Z:\root\python.exe: No module named pip
fixme:ntdll:EtwEventUnregister (deadbeef) stub.


wget https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe


apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main'
apt install winehq-devel






actually python3.4.4. works

wine pyinstaller
fixme:heap:RtlSetHeapInformation (nil) 1 (nil) 0 stub
PyInstaller requires at least Python 2.7 or 3.5+.
 


Tags:

install, python, linux, solutionthis, hacking, debian, ubuntu, executables, platform, pyinstaller, binary, preferable, binaries, doesn, ok, installed, vcrun, installer, didn, winetricks, apt, repository, ppa, builds, recommends, winehq, devel, newer, repo, wget, https, githubusercontent, src, pip, err, module, import_dll, api, crt, runtime, dll, quot, z, vcruntime, wineprefix, encounter, retest, reporting, arg, usage, usr, bin, verb, executes, verbs, installs, bash, discouraged, wiki, org, faq, should_i_run_wine_as_root, supported, upstream, upgrade, info, drwxr, xr, mar, users, registry, reg, user, userdef, tmp, xqncan, early_wine, txt, directory, cmd, exe, echo, programfiles, geekspython, versions, packages, sha, sum, ef, cbc, bd, dfee, winearch, executing, w_do_call, load_vcrun, mkdir, cache, downloading, download, microsoft, fcf, vc_redist, resolving, connecting, http, awaiting, length, octet, stream, mb, xp, mode, show_bug, cgi, native, builtin, override, dlls, conio, heap, locale, stdio, atl, concrt, msvcp, msvcr, ucrtbase, vcomp, regedit, temp, hklm, currentcontrolset, productoptions, producttype, null, winnt, completed, successfully, winxp, winver, wineserver, processes, prefix, terminate, fixme, heapsetinformation, nil, ntdll, ntqueryinformationtoken, queryinformationtoken, tokenelevation, semi, stub, ole, coinitializeex, threading, multi, threaded, advapi, decryptfilew, db, dae, aborting, msxml, software, properties, update, rtlsetheapinformation, shell, shautocomplete, wuapi, automatic_updates_pause, ntlockfile, completion, implemented, automatic_updates_resume, load_library, unsupported, flags, etweventregister, eec, ab, dd, fd, etweventsetinformation, deadbeef, msvcrt, _configure_wide_argv, _initialize_wide_environment, etweventunregister, www, ftp, deb, dl, xenial, requires,

Latest Articles

  • ssh Too many authentication failures not prompting for password
  • LightDM Mint Ubuntu Debian won't start errors Nvidia Graphics
  • WARNING: Unable to determine the path to install the libglvnd EGL vendor library config files. Check that you have pkg-config and the libglvnd development libraries installed, or specify a path with --glvnd-egl-config-path. Linux Ubuntu Mint Debian E
  • How To Upgrade Linux Mint 18.2 to 18.3 to 19.x and 20.x
  • MP3s Won't Play / ID3 Version 2.4 Issues in Cars and Other MP3 Players/CDs/DVDs Solution
  • LXC Containers LXD How to Install and Configure Tutorial Ubuntu Debian Mint
  • GlusterFS HowTo Tutorial For Distributed Storage in Docker, Kubernetes, LXC, KVM, Proxmox
  • Ubuntu Mint audio output not working pulseaudio "pulseaudio[13710]: [pulseaudio] sink-input.c: Failed to create sink input: too many inputs per sink."
  • How To Shrink Dynamically Allocated VM QEMU KVM VMware Disk Image File
  • How To Enable Linux Swapfile Instead of Partition Ubuntu Mint Debian Centos
  • 404 Not Found [IP: 151.101.194.132 80] apt update Debian 11 Bullseye Solution The repository 'http://security.debian.org bullseye/updates Release' does not have a Release file.
  • WARNING: Can't download daily.cvd from db.local.clamav.net freshclam clamav error solution
  • (firefox:9562): LIBDBUSMENU-GLIB-WARNING **: Unable to get session bus: Failed to execute child process "dbus-launch" (No such file or directory) Solution
  • Debian Mint Ubuntu Which Package Provides missing top, ps and w Solution
  • Vbox Virtualbox DNS NAT Network Mode NOT working
  • Docker Tutorial HowTo Install Docker, Use and Create Docker Container Images Clustering Swarm Mode Monitoring Service Hosting Provider
  • Zoom Password Error 'That passcode was incorrect' - Solution Wrong Passcode Wrong Meeting Name
  • How To Startup and Open Remote/Local Folder/Directory in Ubuntu Linux Mint automatically upon login
  • How To Reset Windows Server Password 2019, 2022, 7, 8, 10, 11 Recovery and Removal Guide Using Linux Ubuntu Mint Debian
  • How To Create OpenVPN Server for Secure Remote Corporate Access in Linux Debian/Mint/Ubuntu with client public key authentication