Run python module without pyc extension

I have a compiled Python 2.6 program on Linux called abc.pyc. If I run

./abc.pyc

It works fine. However, if I rename it to abc (i.e., without the pyc extension), it does not start. It gives an error message:

ImportError: No module named abc

How to run a program without a .pyc extension?

UPDATED: I want to run the compiled (pyc) version, not the py version

Alternatively, I know that I can compile modules into .so files using Cython, but can I compile my main Python program with what I can run on the Linux platform? If so, then an example of a command line of Cython will be considered.

UPDATED I posed Keaton's question as a separate question.

+3
source share
4

'abc', :

#!/bin/sh
/usr/bin/env python -m abc

, , ?

, .pyc Python. , ( , ).

+6

.pyc - , .

.py abc, chmod +x ./abc , :

#!/usr/bin/python

#!/usr/bin/env python

, , .pyc Linux-, , .py - , , python ( , ), . ? , . , .

+1

, . Python. , - Python, .pyc, .

+1

Obfuscation.... Python

0

Source: https://habr.com/ru/post/1794439/


All Articles