2017-04-09 2 views
1

python을 사용하여 파이썬 스크립트를 실행하고 있습니다. 그러나 나는 Atom 코드 편집기로 전환 할 필요성을 느꼈다. 파이썬 스크립트를 아무 문제없이 실행할 수 있습니다.원자 편집기에서 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

그게 빠릅니다. 맥그레이디 대단히 감사합니다! – Ivan

관련 문제