Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to create a python virtualenv environment without prompt prefix?

I want to have a "default" virtual environment, and for such I don't want to have a prompt prefix. The following option allows one to customize the prompt prefix for for a given environment:

--prompt=PROMPT       Provides an alternative prompt prefix for this environment

But I couldn't figure out how to use it to set an empty prefix. Is there a way for that?

I was using VIRTUAL_ENV_DISABLE_PROMPT to disable prompt prefix globally, but I changed my mind once I came to know the --prompt option. I want to choose the environment to have no prefix.

like image 719
pepper_chico Avatar asked Apr 27 '13 23:04

pepper_chico


People also ask

How do you create an isolated Python environment?

We use a module named virtualenv which is a tool to create isolated Python environments. virtualenv creates a folder which contains all the necessary executables to use the packages that a Python project would need. After running this command, a directory named my_name will be created.


1 Answers

Set the VIRTUAL_ENV_DISABLE_PROMPT environment variable to 1 before sourcing bin/activate.

If you can't (or don't want to) do this, then you'll have to manually remove the relevant lines from bin/activate. You'll want to delete:

if [ -z "$VIRTUAL_ENV_DISABLE_PROMPT" ] ; then
    # ...
fi
like image 103
icktoofay Avatar answered Oct 22 '22 11:10

icktoofay