Question

How can I start running Python files after closing the Ubuntu terminal?

Posted June 29, 2017 1.3k views
Python Ubuntu 16.04

How can I start running Python files after closing the Ubuntu terminal? In other words how to get a prompt like this in Ubuntu termial: (my_env)rashid@rashid-DH55TC: ~/environments$: This will enable me to execute .py file.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

Hi @RashidHameed

To execute .py files, simply run the command

python name_of_file.py

See this link for more details.

If you are asking about activating your virtual environment (so that in the terminal you see (my_env)rashid@rashid……… ) enable or activate your virtual environment using the command

$ source myenv/bin/activate

That will change

rashid@rashid-DH55TC: ~/environments$:

to

(my_env)rashid@rashid-DH55TC: ~/environments$:

(my_env) is the name of the virtual environment and it’s presence shows that you are now in a virtual environment.

Submit an Answer