user1779646
user1779646

Reputation: 819

Cython standalone executable on ubuntu

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?

Upvotes: 2

Views: 2226

Answers (1)

mgc
mgc

Reputation: 5443

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.

Upvotes: 2

Related Questions