简体   繁体   English

在 64 位 Linux 中的 wine 中安装 32bit-python-3.4

[英]Installing 32bit-python-3.4 in wine in 64bit Linux

I have installed 64bit Debian Stable Linux which is running very well:我已经安装了运行良好的 64 位 Debian Stable Linux:

Linux debian 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u5 (2017-09-19) x86_64 GNU/Linux

I want to install 32bit python-3.4 in it (for XP Windows support also).我想在其中安装 32 位 python-3.4(也支持 XP Windows)。 I tried:我试过:

$ wine msiexec /i python-3.4.0.msi 

but got following error:但出现以下错误:

err:mscoree:LoadLibraryShim error reading registry key for installroot
err:mscoree:LoadLibraryShim error reading registry key for installroot
err:mscoree:LoadLibraryShim error reading registry key for installroot
err:mscoree:LoadLibraryShim error reading registry key for installroot
err:module:import_dll Loading library python34.dll (which is needed by L"C:\\python34\\python.exe") failed (error c000007b).
err:module:LdrInitializeThunk Main exe initialization for L"C:\\python34\\python.exe" failed, status c0000135
err:msi:ITERATE_Actions Execution halted, action L"UpdatePip" returned 1627
err:msi:ITERATE_Actions Execution halted, action L"ExecuteAction" returned 1627

On trying to run it:在尝试运行它时:

$ wine python

The error is:错误是:

wine: cannot find L"C:\\windows\\system32\\python.exe"

How can I solve this problem?我该如何解决这个问题? Thanks for your help.感谢您的帮助。


Edit: This is obviously not ideal method to install Python for Windows, but it is very convenient since one can work in Linux to develop and test applications and then create executable files for Windows using pyinstaller in wine.编辑:这显然不是为 Windows 安装 Python 的理想方法,但它非常方便,因为您可以在 Linux 中开发和测试应用程序,然后在 wine 中使用 pyinstaller 为 Windows 创建可执行文件。 This works very well in Debian Stable 32bit Linux.这在 Debian 稳定版 32 位 Linux 中非常有效。

Python is installed in ~/.wine/drive_c/python34 as follows: Python 安装在~/.wine/drive_c/python34如下:

$ ls -l
total 4168
drwxr-xr-x 34 cardio cardio    4096 Feb 13 15:10 Lib
-rwxr-xr-x  1 cardio cardio  102400 Mar 16  2014 py.exe
-rw-r--r--  1 cardio cardio 4044800 Mar 16  2014 python34.dll
-rwxr-xr-x  1 cardio cardio  102912 Mar 16  2014 pyw.exe
drwxr-xr-x  2 cardio cardio    4096 Feb 12 08:23 Scripts
drwxr-xr-x  5 cardio cardio    4096 Feb 11 23:10 Tools

But on running py.exe:但是在运行 py.exe 时:

$ wine ./py.exe 
Can't find a default Python.

Following also does not work:以下也不起作用:

$ wine python34.exe
wine: cannot find L"C:\\windows\\system32\\python34.exe"

Edit: As suggested by @laszlowaty in comments, I installed python34 (64bit) in Windows and copied the python34 folder to wine c_disk, but it does not work:编辑:正如@laszlowaty 在评论中所建议的,我在 Windows 中安装了 python34(64 位)并将 python34 文件夹复制到了 wine c_disk,但它不起作用:

$ wine ./python.exe
err:module:import_dll Library python34.dll (which is needed by L"C:\\Python34\\python.exe") not found
err:module:LdrInitializeThunk Main exe initialization for L"C:\\Python34\\python.exe" failed, status c0000135

I could not find python34.dll in Windows.我在 Windows 中找不到 python34.dll。


Edit: I had to do a reinstall of my Debian Stable 64bit Linux distribution.编辑:我必须重新安装我的 Debian 稳定版 64 位 Linux 发行版。 After this I again tried and python-3.4.0.msi installed perfectly well this time.之后我再次尝试,这次python-3.4.0.msi安装得很好。 Thanks everyone for your help.感谢大家的帮助。

it makes perfect sense to install python on wine.在 wine 上安装 python 是非常有意义的。 - cross platform development - development for scripts used under wine (there are differences between windows and wine that needs to be adressed, for instance in the registry) - we use wine to replace some windows boxes, because it is faster in many cases - 跨平台开发 - 开发wine 下使用的脚本(windows 和wine 之间存在差异,需要解决,例如在注册表中) - 我们使用wine 替换一些windows 框,因为在许多情况下它更快

And if You create multiprocessing multi-platform code that should run álso on Windows, I stongly recommend to test on windows/wine, because windows is the most limited os (I am talking about : no forking on Windows, no Signals on Windows, Functions and Classes must be pickable to spawn a new process, etc... )如果您创建了应该在 Windows 上运行的多处理多平台代码,我强烈建议在 Windows/wine 上进行测试,因为 Windows 是最有限的操作系统(我说的是:Windows 上没有分叉,Windows 上没有信号,函数并且类必须是可选择的以产生新的进程,等等...)

Nowadays most Programs I develop on Windows, and test them parallel on Linux / Osx (because usually there they will most likely run anyway)现在我在 Windows 上开发的大多数程序,并在 Linux / Osx 上并行测试它们(因为通常在那里它们很可能无论如何都会运行)

I made a build example here, it contains bash scripts to automatically install Wine and Python on Your Ubuntu machine :我在这里做了一个构建示例,它包含 bash 脚本,用于在您的 Ubuntu 机器上自动安装 Wine 和 Python:

https://github.com/bitranox/install_python_on_wine_and_travis https://github.com/bitranox/install_python_on_wine_and_travis

I have used this guide for 3.4 and 3.5.我已将本指南用于 3.4 和 3.5。 Here is what you need to do:以下是您需要做的:

#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

#3 run the installer
wine python-3.4.4.exe

Source: http://realtechtalk.com/How_To_Install_python_34_35_and_up_on_Linux_with_wine_Working_Solution-2288-articles来源: http : //realtechtalk.com/How_To_Install_python_34_35_and_up_on_Linux_with_wine_Working_Solution-2288-articles

This is terrible way to do it.这是一种可怕的方式。 Python is build as portable , this means you can just install python for your debian (in fact there is python shipped with debian, but you can install more versions of python). Python 构建为portable ,这意味着您只需为您的 debian 安装 python(实际上 debian 附带了 python,但您可以安装更多版本的 python)。

If you have some specific reason to use windows version, wine is not a way to go.如果您有某些特定原因使用 windows 版本, wine不是一种方法。 Much better (and easier) way is to use VirtualBox and emulate whole windows.更好(更简单)的方法是使用VirtualBox并模拟整个窗口。 I am not even sure if it's possible to fully run python using wine.我什至不确定是否可以使用 wine 完全运行 python。

edit: Can you go to your C drive in wine and find where is your python.exe file?编辑:你能在wine中转到你的C盘并找到你的python.exe文件在哪里吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM