[PYTHON] Enable intellisense for external libraries with Pipenv + VS Code

Verified environment

macOS-10.15.5Python-3.8.5Pipenv-1.2.20VisualStudioCode-1.48.1

Overview

If you do not make any settings when developing Python with VS Code Since only the standard library has intellisense enabled, the development speed will be slowed down. Set so that intellisense is effective even when using an external library as well as the standard library.

procedure

1. Examine the virtual environment created by Pipenv

pipenv --venv

Command execution result image


#The path of the virtual environment is displayed
/Users/xxx/work/fastapi-demo/.venv

2. Find out the path where the external library is

There is an external library in site-packages under .venv

path


/Users/xxx/work/fastapi-demo/.venv/lib/python3.8/site-packages/

3. Set 2 paths in VS Code basic settings

Set the path to 2 in python.autoComplete.extraPaths

スクリーンショット 2020-09-17 8.38.56.png スクリーンショット 2020-09-17 8.40.45.png スクリーンショット 2020-09-17 9.05.07.png

4. Make sure Intellisense is enabled

スクリーンショット 2020-09-17 8.49.55.png

reference

Recommended Posts

Enable intellisense for external libraries with Pipenv + VS Code
VS Code settings for developing in Python with completion
Make Visual Studio Code autocomplete for python external libraries
Python with VS Code (Windows 10)
Install external libraries with Python
Debug Python with VS Code
Comfortable LaTeX with Windows Subsystem for Linux and VS Code
VS Code snippets for data analysts
[Note] VS Code cv2 intellisense error
Try running Jupyter with VS Code
Debug settings in virtual environment when using Pipenv with VS Code
Install python with mac vs code
Impressions and memorandums when working with VS code for the first time
(For myself) Put Flask in VS Code
Pass PYTHONPATH in 1 minute with VS Code
Display Japanese graphs with VS Code + matplotlib
VS Code Pylint is annoying with import! !! !! !!
I tried Flask with Remote-Containers of VS Code
Python (Windows 10) Virtual Environment / Package with VS Code
Debug with VS Code using boost python numpy
Use Python in Anaconda environment with VS Code
Use Docker development container conveniently with VS Code
Make your Python environment "easy" with VS Code
Build a python execution environment with VS Code
Set up TinyGo development environment for VS Code
Summary of reference sites when editing Blender Script with an external editor (VS Code)