2017-04-09 10 views
1

pythonを使ってpythonスクリプトを実行しています。しかし、私はAtomコードエディタに切り替える必要があると感じました。私は問題なくPythonスクリプトを実行できます。matplotlib.pyplotをアトムエディタでインポートする

ある時点で、ライブラリmatplotlibを使用する必要があります。 pyzoで私はどうなる:

import matplotlib.pyplot as plt 

をしかし、それはアトムに enter image description here

エラーメッセージを動作しません:

私はmatplotlibのをインストールするためのはず

Traceback (most recent call last): File "C:\Users\ivanl\Desktop\python trade\matplotlib.py", line 1, in import matplotlib.pyplot as plt File "C:\Users\ivanl\Desktop\python trade\matplotlib.py", line 1, in import matplotlib.pyplot as plt ImportError: No module named 'matplotlib.pyplot'; 'matplotlib' is not a package

?なぜそれが原子ではなく、pyzoで動作していますか?

答えて

2

The Module Search Path。あなたは、標準ライブラリまたは内蔵モジュール名と同じ名前を使用してモジュールを付けないようにする必要があり意味

When a module named spam is imported, the interpreter first searches for a built-in module with that name. If not found, it then searches for a file named spam.py in a list of directories given by the variable sys.path . sys.path is initialized from these locations:

  • the directory containing the input script (or the current directory).
  • PYTHONPATH (a list of directory names, with the same syntax as the shell variable PATH).
  • the installation-dependent default.

matplotlib.pyではなく、スクリプトファイルの名前を変更する必要があります。

+0

これはすばらしかった。 McGradyさん、ありがとうございました! – Ivan

関連する問題