简体   繁体   中英

I cannot import pylab - even though matplotlib, numpy and scipy are already installed (Python)

I am sorry for asking this question again, but I could not find any answer to my problem that helped me. I don't have much experience with python. I use python version 3.6.8 on Windows and I have already installed matplotlib, numpy and scipy. The 'pylab.py' file is also contained in the matplotlib folder. Edit: Using matplotlib.pyplot also doesn't work.

Edit: After some more trials I got the error that the module 'six.names" could not be found. The six package has been installed.

import pylab
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pylab
ModuleNotFoundError: No module named 'pylab'
 import matplotlib.pyplot
Traceback (most recent call last):
  File "<pyshell#21>", line 1, in <module>
    import matplotlib.pyplot
  File "C:\...\Python36-32\lib\matplotlib\pyplot.py", line 30, in <module>
    from cycler import cycler
  File "C:\...\Python36-32\lib\cycler\cycler.py", line 48, in <module>
    from six.moves import zip, reduce
ModuleNotFoundError: No module named 'six.moves'

Per https://matplotlib.org/faq/usage_faq.html#matplotlib-pyplot-and-pylab-how-are-they-related , pylab is not recommended; you should use pyplot instead.

The correct way to import either is

import matplotlib.pyplot  # use this
import matplotlib.pylab  # only if you cannot avoid it

(pyplot and pylab are not standalone modules, but submodules of matplotlib.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM