Python 导入错误:没有名为 6 的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13967428/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 10:04:06  来源:igfitidea点击:

ImportError: No module named six

pythonmoduleimporterror

提问by asadullah07

I'm trying to build OpenERP project, done with dependencies. It's giving this error now

我正在尝试构建 OpenERP 项目,完成依赖项。现在出现这个错误

Traceback (most recent call last):
  File "openerp-client.py", line 105, in <module>
  File "modules\__init__.pyo", line 23, in <module>
  File "modules\gui\__init__.pyo", line 22, in <module>
  File "modules\gui\main.pyo", line 33, in <module>
  File "rpc.pyo", line 29, in <module>
  File "common\__init__.pyo", line 22, in <module>
  File "common\common.pyo", line 26, in <module>
  File "tools\__init__.pyo", line 28, in <module>
  File "dateutil\relativedelta.pyo", line 12, in <module>
ImportError: No module named six

Could someone guide what's wrong and how it can be fixed???

有人可以指导出什么问题以及如何解决吗???

采纳答案by Sylvain Defresne

You probably don't have the sixPython module installed. You can find it on pypi.

您可能没有six安装 Python 模块。你可以在pypi上找到它。

To install it:

要安装它:

$ easy_install six

(if you have pipinstalled, use pip install sixinstead)

(如果已pip安装,请pip install six改用)

回答by user144437

On Ubuntu and Debian

在 Ubuntu 和 Debian 上

apt-get install python-six

does the trick.

诀窍。

Use sudo apt-get install python-sixif you get an error saying "permission denied".

sudo apt-get install python-six如果您收到“权限被拒绝”的错误消息,请使用。

回答by 3ygun

If pip "says" six is installed but you're still getting:

如果 pip "says" 6 已安装,但您仍然得到:

ImportError: No module named six.moves

ImportError: No module named six.moves

try re-installing six (worked for me):

尝试重新安装六个(对我有用):

pip uninstall six
pip install six

回答by bcag2

on Ubuntu Bionic (18.04), six is already install for python2 and python3 but I have the error launching Wammu. @3ygun solution worked for me to solve

在 Ubuntu Bionic (18.04) 上,已经为 python2 和 python3 安装了六个,但是我在启动 Wammu 时出错。@3ygun 解决方案为我解决了

ImportError: No module named six

when launching Wammu

启动 Wammu 时

If it's occurred for python3 program, six come with

如果是python3程序发生的,则有六个

pip3 install six

and if you don't have pip3:

如果您没有 pip3:

apt install python3-pip

with sudounder Ubuntu!

在 Ubuntu 下使用sudo

回答by Rochan

For Mac OS X:

对于 Mac OS X:

pip install --ignore-installed six

回答by Tom Hale

pip install --ignore-installed six

Source: 1233 thumbs up on this comment

来源:1233 点赞此评论

回答by SahanWickramage

I did the following to solve the mentioned problem. I got the mentioned problem when I was trying to run the built exe, even I successfully built the exe using pyinstaller. I did this on Windows 10.

我做了以下来解决提到的问题。我在尝试运行构建的 exe 时遇到了提到的问题,即使我使用 pyinstaller 成功构建了 exe。我在 Windows 10 上做了这个。

  1. go to https://pypi.org/project/six/#files
  2. download "six-1.14.0.tar.gz (33.9 kB)"
  3. unzip it, copy and paste "six.py" into your source directory.
  4. import "six" module into your source code (import six)
  5. run source script.
  1. https://pypi.org/project/six/#files
  2. 下载 "6-1.14.0.tar.gz (33.9 kB)"
  3. 解压缩它,将“six.py”复制并粘贴到您的源目录中。
  4. 将“六个”模块导入您的源代码(导入六个)
  5. 运行源脚本。