LoginSignup
11
6

More than 5 years have passed since last update.

Jupyter notebookでのみ module import errorが起こるときの簡単な解決方法

Posted at

題名どおりのことが起こった時の一番簡単な解決方法はjupyter上で!pip installでmoduleをインストールし直すこと。

例) jupyterでpandasがimportできないとき、下記のコマンドをjupyter上で実行。

Jupyter
!pip install pandas

jupyter上で!(エクスクラメーション)後にコマンドを打てばシステムコマンドを実行できるのを知らんかった。覚えておくべき。
https://heavywatal.github.io/python/ipython.html

ちなみに上記の方法を綺麗なやり方じゃない。というのもすでにpandasインストール済みの場合はpandasが2個存在することになるので。
本来的な解決方法は
http://pyth0n.hatenablog.com/entry/2016/10/28/jupyterでimport_error
である。
ただ俺の場合は、この方法を使うとpandasのインストールエラーは解消されたが、別のpandas依存モジュールのインストールエラーが出た。キレてつい楽な方に手を出してしまった。反省は若干している。

11
6
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
11
6