7
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VSCodeにvenv環境を認識させる方法とそのメリット

Last updated at Posted at 2019-12-07

環境

  • macOS
  • VSCode 1.40.1
  • Python3.6.0

VSCodeにvenv環境を認識させる

.vscode/settings.json に下記を追加(下記はpython -m venv .venvで仮想環境を作成した場合)

.vscode/settings.json
    "python.venvFolders": [
        ".venv"
    ]

VSCodeでCommand+Shift+Pで「Python: インタープリターを選択」を選択し、表示された一覧から上記で設定した.venvのPython(./venv/bin/pythonなど)を選択する

メリット

Linterが仮想環境にインストール済みのライブラリを認識してくれるため、「インストール済みなのにNot found警告が出る!」なんてことにならない。

7
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?