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

  • How To Upgrade Debian 8,9,10 to Debian 12 Bookworm
  • Linux dhcp dhclient Mint Redhat Ubuntu Debian How To Use Local Domain DNS Server Instead of ISPs
  • Docker dockerd swarm high CPU usage cause solution
  • Docker Minimum Requirements/How Efficient is Docker? How Much Memory Does Dockerd Use?
  • qemu-nbd: Failed to set NBD socket solution qemu-nbd: Disconnect client, due to: Failed to read request: Unexpected end-of-file before all bytes were read
  • apache2 httpd apache server will not start [pid 22449:tid 139972160445760] AH00052: child pid 23248 exit signal Aborted (6) solution Mint Debian Ubuntu Redhat
  • How to use the FTDI USB serial cable to RJ45 adapter to connect to the console on Cisco/Juniper Switch Router Firewall in Linux Ubuntu Debian Redhat
  • How To Setup Python3 in Ubuntu Docker Image for AI Deep Learning
  • How to Configure NVIDIA GPUs with Docker on Ubuntu: A Comprehensive Guide for AI Deep Learning CUDA Solution
  • Linux Ubuntu Mint how to check nameservers when /etc/resolv.conf disabled solution
  • Docker cannot work on other overlayfs filesystems such as ecryptfs won't start overlayfs: filesystem on '/home/docker/overlay2/check-overlayfs-support130645871/upper' not supported as upperdir
  • Linux How To Access Original Contents of Directory Mounted Debian Mint CentOS Redhat Solution
  • ecryptfs how to manually encrypt your existing home directory or other directory
  • How to Reset CIPC Cisco IP Communicator for CME CUCM CallManager
  • Internet Explorer Cannot Download File "Your security settings do not allow for this file to be downloaded." Security Settings Solution
  • Linux How To Upgrade To The Latest Kernel Debian Mint Ubuntu
  • Firefox how to restore and backup saved passwords and history which files/location
  • Linux How To echo as root solution to use tee permission denied solution Ubuntu Debian Mint Redhat CentOS
  • Linux how to keep command line bash process running if you are disconnected or need to logout of SSH remotely
  • Linux swapping too much? How to check the swappiness and stop swapping