1
0

More than 1 year has passed since last update.

Pythonでfirestoreライブラリがインポートできない...(VSCode)

Last updated at Posted at 2022-02-28

原因

VSCodeのインタプリタ設定が誤っていました。

事象

launch.jsonおよびsettings.jsonの設定でパスは通っているはずなのに、「from firebase_admin import firestore」で下記エラーが発生・・・なぜ?

例外が発生しました: ImportError
Failed to import the Cloud Firestore library for Python. Make sure to install the "google-cloud-firestore" module.

※コマンドラインからは実行可能だけど、VSCodeでデバッグ実行しようとするとエラー。VSCodeの設定がどこかおかしい!

対応

①コマンドパレットを開いて「インタープリターを選択」
windowsの場合、Ctrl+Shift+P で開きます
image.png
バージョンが違っていました↓(インストールしたPythonは3.10だった)。
image (1).png
ので、3.10を選択して解決。

反省

VSCodeインストール時に確認すればよかった。。
https://python.softmoco.com/devenv/how-to-setup-vs-code-for-python.php#2

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