3
1

More than 1 year has passed since last update.

VSCODEでstreamlitのパスが認識されないエラー

Last updated at Posted at 2022-02-25

VSCODEで以下のように実行すると「could not be resolved(reportMissingImports)」とエラーが発生した。(streamlit、numpy、pandasすべてで)
なんとか、解決できたため備忘録として記載しておく。

image.png

エラー内容「reportMissingImports」を調べてみると、以下のように表示されstreamlitを探せていないように感じた。
image.png

ターミナルでpythonと打ち、対話モードへ
import streamlitと
print(streamlit.__ file __)も入力。

image.png

そうすると、streamlitの場所(パス)が表示される。
C:\anaconda3\lib\site-packages\までをコピー

VSCODE→ファイル→ユーザー設定→設定→設定の検索→extra pathと入力

Python › Analysis: Extra Pathsを見つけて、項目の追加を選択し
先ほどコピーしたC:\anaconda3\lib\site-packages\を貼り付ければok
image.png

エラー内容を調べて理解し、自分が欲しい情報を探し出す力が必要だと感じた。

以下、参考にしたサイト
参考:Visual Studio Codeでライブラリやモジュールが could not be resolved になる時の対処法
URL:https://startlab.jp/learning-python/vscode-settings/

3
1
1

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
3
1