64位-使用python 64位运行32位程序



我想通过python使用os运行一个程序。系统或子进程。调用之类的,但这个程序是32位程序,我的python是64位的,找不到这个程序来运行它。通过python运行程序的最简单方法是什么?

更多细节:我使用ubuntu,运行python 2.7,安装ia32-libs(程序从命令行运行完美),使用idle运行python。

谢谢!

=============(当天晚些时候)=============

好的,明白了。问题是在只使用IDLE时出现的(不知道为什么)。使用其他gui (iron python, eclipse)不会返回错误。

subprocess.call("command param1 param2", shell=True)

适合我。你确定是32/64位的问题吗?

我同意Thorsten的观点:这应该没问题。我在Debian稳定版上使用64位python2.6和32位xsnow进行了测试:

$ file $(which python2.6)
/usr/bin/python2.6: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
$ file ~/bin/xsnow 
/home/myuser/bin/xsnow: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped
aschmitz@dpcl001:~
$ python
Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.call( "~/bin/xsnow", shell=True )
Xsnow-1.42, December 14th 2001 by Rick Jansen (rja@euronet.nl)
WWW: http://www.euronet.nl/~rja/Xsnow/

你能提供一个失败的示例代码吗?

最新更新