LoginSignup
0
0

More than 1 year has passed since last update.

【VSCode】インストールしたライブラリが could not be resolved となった場合の対処法

Posted at

事象

pythonでmatplotlibをimportしようとしたら、could not be resolvedという警告が表示された
なお、matplotlibは既にインストール済みであり、プログラムは問題なく動作する

環境

項目 情報
OS Windows 10
Python 3.9.13
VSCode 1.73.1

原因

VSCodeがmatplotlibを見つけることができていない

対処方法

以下サイトを参考に以下二つの対応を実施

1. ライブラリがインストールされている場所を調べる

入力

pip show matplotlib

出力

Name: matplotlib
Version: 3.6.2
Summary: Python plotting package
Home-page: https://matplotlib.org
Author: John D. Hunter, Michael Droettboom
Author-email: matplotlib-users@python.org
License: PSF
Location: c:\git\.venv\lib\site-packages
Requires: contourpy, cycler, fonttools, kiwisolver, numpy, packaging, pillow, pyparsing, python-dateutil
Required-by:

2. VSCodeの設定追加

  1. 「ファイル」-「ユーザ設定」-「設定」を選択
  2. 「設定の検索」の欄にextra pathと入力
  3. 「項目の追加」をクリックして、1で調べたLocationのパスを入力する
0
0
2

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
0
0