Cython standalone executable on ubuntu

故事扮演 提交于 2019-12-11 06:41:28

问题


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

cython --embed

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


回答1:


I guess you have to compile the .c file you have obtained.

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

(you might need to remove the m following the version number)

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



来源:https://stackoverflow.com/questions/39769516/cython-standalone-executable-on-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!