3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Python】IPythonを起動するとModuleNotFoundErrorが出る

Last updated at Posted at 2019-06-28

環境

  • Windows 10
  • Python=3.7.3
  • IPython=7.5.0

エラーの内容

$ pip install ipython

でipythonをインストールし、

$ ipython

で起動すると、以下のようなエラーが出てきました。

$ ipython

Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.5.0 -- An enhanced Interactive Python. Type '?' for help.
[TerminalIPythonApp] WARNING | Error in loading extension: line_profiler
Check your config files in C:\Users\user\.ipython\profile_default
Traceback (most recent call last):
 File "C:\Users\user\Anaconda3\envs\practice\lib\site-packages\IPython\core\shellapp.py", line 261, in init_extensions
   self.shell.extension_manager.load_extension(ext)
 File "C:\Users\user\Anaconda3\envs\practice\lib\site-packages\IPython\core\extensions.py", line 80, in load_extension
   mod = import_module(module_str)
 File "C:\Users\user\Anaconda3\envs\practice\lib\importlib\__init__.py", line 127, in import_module
   return _bootstrap._gcd_import(name[level:], package, level)
 File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
 File "<frozen importlib._bootstrap>", line 983, in _find_and_load
 File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'line_profiler'
[TerminalIPythonApp] WARNING | Error in loading extension: memory_profiler
Check your config files in C:\Users\user\.ipython\profile_default
Traceback (most recent call last):
 File "C:\Users\user\Anaconda3\envs\practice\lib\site-packages\IPython\core\shellapp.py", line 261, in init_extensions
   self.shell.extension_manager.load_extension(ext)
 File "C:\Users\user\Anaconda3\envs\practice\lib\site-packages\IPython\core\extensions.py", line 80, in load_extension
   mod = import_module(module_str)
 File "C:\Users\user\Anaconda3\envs\practice\lib\importlib\__init__.py", line 127, in import_module
   return _bootstrap._gcd_import(name[level:], package, level)
 File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
 File "<frozen importlib._bootstrap>", line 983, in _find_and_load
 File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'memory_profiler'

'line_profiler'と'memory_profiler'というモジュールが見つからないと怒られました。

解決法

'line_profiler'と'memory_profiler'をインストールします。

memory_profilerインストール

$ pip install memory_profiler

line_profilerインストール

こちらからLine_profilerのwhlファイルをダウンロードしてインストールします。
自分の環境に合うファイルは以下のようにして調べます。

>>> from pip._internal.pep425tags import get_supported
>>> get_supported()

[('cp37', 'cp37m', 'win_amd64'),
 ('cp37', 'none', 'win_amd64'),
 ('py3', 'none', 'win_amd64'),
 ('cp37', 'none', 'any'),
 ('cp3', 'none', 'any'),
 ('py37', 'none', 'any'),
 ('py3', 'none', 'any'),
 ('py36', 'none', 'any'),
 ('py35', 'none', 'any'),
 ('py34', 'none', 'any'),
 ('py33', 'none', 'any'),
 ('py32', 'none', 'any'),
 ('py31', 'none', 'any'),
 ('py30', 'none', 'any')]

私の場合は、'line_profiler‑2.1.2‑cp37‑cp37m‑win_amd64.whl'をダウンロードすれば良さそうです。

あとは、

$ pip install {ダウンロードしたwhlファイルのパス}

これでエラーは消えました。

参考URL

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?