[英]Cython compiled app requires python to be installed?
I have the following small program: 我有以下小程序:
import urllib2,os
urls = ['http://stahlworks.com/dev/sfk/sfk.exe','http://stahlworks.com/dev/sfk/sfk.exe','http://stahlworks.com/dev/sfk/sfk.exe','http://stahlworks.com/dev/sfk/sfk.exe']
for fruit in urls:
url = fruit
file_name = url.split('/')[-1]
u = urllib2.urlopen(url)
f = open(file_name, 'wb')
meta = u.info()
file_size = int(meta.getheaders("Content-Length")[0])
print "Downloading: %s Bytes: %s" % (file_name, file_size)
os.system('cls')
file_size_dl = 0
block_sz = 8192
while True:
buffer = u.read(block_sz)
if not buffer:
break
file_size_dl += len(buffer)
f.write(buffer)
status = r"%10d [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)
status = status + chr(8)*(len(status)+1)
print status,
f.close()
I compiled it using Cython: 我用Cython编译了它:
python cython.py --embed -o hello.c h.py
then I compiled it using gcc: 然后我用gcc编译了它:
gcc.exe -I"c:\\python27\\include" -L"c:\\python27\\libs" hello.c -ohello.exe -lpython27
After I compile it it runs fine, until I try it on a computer without python/ python27 renamed to python27x then I get the following error: 编译后,它运行良好,直到我在未将python / python27重命名为python27x的计算机上尝试使用它时,我得到以下错误:
The application was unable to start correctly (0xc000007b). Click OK to close the application.
Is there any way I can get around this and build a truly standalone app? 我有什么办法可以解决这个问题,并构建一个真正的独立应用程序?
I have used py2exe ( http://www.py2exe.org/ ) with reasonable success for windows applications. 对于Windows应用程序,我已经使用py2exe( http://www.py2exe.org/ )取得了一定的成功。 It packages up what's needed to run things in a nice way, including basic python libs.
它打包了以一种不错的方式运行事物所需的东西,包括基本的python库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.