ubuntu上的Cython独立可执行文件 [英] Cython standalone executable on ubuntu

查看:211
本文介绍了ubuntu上的Cython独立可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的cython程序在Linux上是独立的可执行文件,而不是导入的。

I want my cython program to be standalone executable on linux, not to be imported. After


cython --embed

cython --embed

之后我有一个ac文件,现在如何使它可执行?

i got a c file,now how can i make it executable?

推荐答案

我想您必须编译 .c 文件。

假设您使用的是python 3.5,并且不必链接到python以外的其他库,则可以使用简单的 gcc 命令执行此操作,例如:

Assuming you are using python 3.5 and don't have to link to other libraries than python you can do this with a simple gcc command like :

gcc -I /usr/include/python3.5m -o your_program your_file.c -lpython3.5m

(您可能需要删除版本号后的 m

如您所料,它将使用 if __name__ == __main __:语句作为程序的入口点。

As you expect it will use the if __name__ == "__main__": statement as entry-point of the program.

这篇关于ubuntu上的Cython独立可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆