Select pyenv environment based on folder .python-version file
See original GitHub issueEnvironment data
- VS Code version: 1.21.1
- Extension version (available under the Extensions sidebar): 2018.2.1
- OS and version: macOS 10.13.3
- Python version (& distribution if applicable, e.g. Anaconda): Python 3.6.4
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): pyenv
- Relevant/affected Python packages and their versions: pyenv 1.2.1
Actual behavior
You have to manually select the pyenv interpreter for each workspace folder.
Expected behavior
It should detect the workspace pyenv interpreter based on the .python-version
file present in the workspace folder root.
For example, every folder I have added to my workspace has a .python-version
file that pyenv creates when you run pyenv local NAME_OF_VENV
in that folder. The file contains a single string which is the name of the folder/symlink in ~/.pyenv/versions/
that should be used.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:106
- Comments:8 (4 by maintainers)
Top Results From Across the Web
python 3.x - Pyenv choose virtualenv directory
In your project directory, create a .python-version file. Assuming you already installed some virtual environment using pyenv-virtualenv ...
Read more >Setting up your python development environment ...
As shown below, we'll first set the Python environment with pyenv , and then make a couple virtual environments with virtualenvwrapper . Then...
Read more >Python: Version Management with Pyenv and ...
To list all the available versions of python to be installed use the following command. pyenv install --list. Now choose the version you...
Read more >Managing Multiple Python Versions With pyenv
This command creates a .python-version file in your current directory. If you have pyenv active in your environment, this file will automatically activate...
Read more >How to Manage your Python Projects with Pipenv and Pyenv
This will create a .python-version file in the folder indicating the current local ... Set up very quickly a working Python environment.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://github.com/pyenv/pyenv#choosing-the-python-version has the specification on how pyenv chooses an interpreter by default. I think detecting the file and using it as appropriate seems like a sensible enhancement (maybe even the file traversal to the parent directory, but not as sure on that one).
@djdembeck please make sure to upvote the opening comment as that’s how we determine community interest.