Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate virtualenv: Example #444

Open
pgy866 opened this issue Jan 3, 2023 · 0 comments
Open

Activate virtualenv: Example #444

pgy866 opened this issue Jan 3, 2023 · 0 comments

Comments

@pgy866
Copy link

pgy866 commented Jan 3, 2023

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 folder my-virtual-env-2.7.10, and add the text of the micro virtual space name my-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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant