[英]Error No module named six
I am new to Python/OpenCV.我是 Python/OpenCV 的新手。
I have the code below run in Python.我有下面的代码在 Python 中运行。 But I got an error as shown below.
但我得到一个错误,如下所示。
>>> from matplotlib import pyplot as plt
Traceback (most recent call last):
File "<pyshell#20>", line 1, in <module>
from matplotlib import pyplot as plt
File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 105, in <module>
import six
ImportError: No module named six
I followed what is being suggested in this post: ImportError: No module named six我遵循了这篇文章中的建议: ImportError: No module named Six
I have downloaded six-1.8.0.tar.gz and unzip the file.我已经下载了 6-1.8.0.tar.gz 并解压文件。 I am wondering of is the next thing to do?
我想知道接下来要做的事情是什么? I tried to run the six.py but I still got the same error.
我尝试运行 Six.py,但仍然遇到同样的错误。
You shouldn't need to download the tar.gz
file. 您不需要下载
tar.gz
文件。 Instead run this at the command line (note, not the Python command line): 而是在命令行上运行此命令(注意,不是Python命令行):
pip install six
And if that doesn't work, try: 如果那不起作用,请尝试:
easy_install six
I met the same problem (No module named six) when I tried to import nltk
and to type easy_install six
in cmd (Windows), it installed six
for me. 当我尝试导入
nltk
并在cmd(Windows)中键入easy_install six
,遇到了相同的问题(没有模块命名为六个),它为我安装了six
。
And I imported nltk
successfully. 而且我成功导入了
nltk
。
Here's my experience when following this posts advice:以下是我在遵循此帖子建议时的经验:
pip install six Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: six in /usr/lib/python3/dist-packages (1.16.0)
pip install --ignore-installed six Defaulting to user installation because normal site-packages is not writeable Collecting six Downloading six-1.16.0-py2.py3-none-any.whl (11 kB) Installing collected packages: six Successfully installed six-1.16.0
easy_install six easy_install: command not found
I hope this helps a lot of other people, because:我希望这对其他人有帮助,因为:
ModuleNotFoundError: No module named 'six'
This happens regardless if the module is installed or not.无论模块是否安装,都会发生这种情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.