Mac + fish + pyenv + VSCode (April 2020)

When building a local development environment with a combination of titles, I didn't get any good information, so make a note of it.

environment

Premise that fish (shell) is already used.

goal

Make Python 3.8 available for projects under development with VS Code.

procedure

Homebrew installation

Omitted

pyenv installation

Do it via Homebrew.

brew install pyenv

Shell settings

Create a new file below.

~/.config/fish/conf.d/pyenv.fish


pyenv init - | source

Settings as in the official documentation. There is a lot of information on the net that contains settings using the psub command, but they may be old settings.

Install Python3.8, create virtual environment (venv)

$ pyenv install 3.8.2

#Run in the root directory of your project using the installed Python
$ pyenv local 3.8.2

# .python-There should be a file called version
$ ls .python-version
.python-version

#Check Python version
$ python --version
Python 3.8.2 

#Creating a virtual environment
python -m venv venv

vscode When I opened this project (directory), the virtual environment (python under venv) was recognized without permission.

Reference link

Recommended Posts

Mac + fish + pyenv + VSCode (April 2020)
Install pyenv on mac
Pyenv + virtualenv on Mac
pyenv + fish environment construction
Pyenv on Mac OSX Mavericks
Catalina on Mac and pyenv
(Beginner) Notes on using pyenv on Mac