Activate virtualenv: Example
pgy866 opened this issue · comments
Activate virtualenv
Some external tools (e.g. jedi) might require you to activate the virtualenv and conda environments.
If eval "$(pyenv virtualenv-init -)" is configured in your shell, pyenv-virtualenv will automatically activate/deactivate virtualenvs on entering/leaving directories which contain a .python-version file that contains the name of a valid virtual environment as shown in the output of pyenv virtualenvs (e.g., venv34 or 3.4.3/envs/venv34 in example above) . .python-version files are used by pyenv to denote local Python versions and can be created and deleted with the pyenv local command.
- For example::The virtual space name is
my-virtual-env-2.7.10
,Create a file named.python-version
in the virtual space foldermy-virtual-env-2.7.10
, and add the text of the micro virtual space namemy-virtual-env-2.7.10
echo "my-virtual-env-2.7.10" >> $HOME/.pyenv/versions/2.7.10/envs/my-virtual-env-2.7.10/.python-version
You can also activate and deactivate a pyenv virtualenv manually:
pyenv activate <name>
pyenv deactivate