Report this

What is the reason for this report?

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

Posted on June 29, 2017

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.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.