Your question is unclear. It looks like what you want is to run your program from the command line without explicitly invoking the Python interpreter.
To do this, you just need a few lines in your setup.py to declare an entry point. That is explained in Automatic Script Creation. Basically, you need a console_scripts item:
setup(
# other arguments here...
entry_points = {
'console_scripts': ['foo = my_package.some_module:main_func']
}
)
You can see something similar in lines 68-71 of the setup.py file for youtube-dl.
If you really want to read environment variables, use environ from the os module.
import os
try:
important_info = os.environ['IMPORTANT_INFO']
except KeyError:
raise Exception('Set IMPORTANT_INFO environment variable, please!')