How do you change the default Virtualenvwrapper prompt? By default, working on a particular virtual environment with a command like workon <_name_of_env_>
prepends the name of the virtualenv to your prompt. This may work poorly if you're not using a default command prompt.
Installing Virtualenv using pip3 Virtualenv is only installed on DreamHost servers for Python 2. If you're working with Python 3, you must install virtualenv using pip3. pip3 is not installed on the server by default.
To install virtualenv, just use pip install virtualenv . To create a virtual environment directory with it, type virtualenv /path/to/directory . Activating and deactivating the virtual environment works the same way as it does for virtual environments in Python 3 (see above).
If you are working on a custom PS1 (as I when found out this issue), I recommend you to disable prompt change, use export VIRTUAL_ENV_DISABLE_PROMPT=1
(see virtualenv docs), and make your own virtualenv prompt in order to add to your PS1.
See this snippet that I've used:
function virtualenv_info(){ # Get Virtual Env if [[ -n "$VIRTUAL_ENV" ]]; then # Strip out the path and just leave the env name venv="${VIRTUAL_ENV##*/}" else # In case you don't have one activated venv='' fi [[ -n "$venv" ]] && echo "(venv:$venv) " } # disable the default virtualenv prompt change export VIRTUAL_ENV_DISABLE_PROMPT=1 VENV="\$(virtualenv_info)"; # the '...' are for irrelevant info here. export PS1="... ${VENV} ..."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With