繁体   English   中英

如何在Python2.7中安装Six模块

[英]How to install the Six module in Python2.7

我正在使用Python 2.7并尝试使用dateutil ,如下所示:

from dateutil import parser as _date_parser

但是,我收到以下错误:

Traceback (most recent call last):
  File "<pyshell#17>", line 1, in <module>
    from dateutil import parser as _date_parser
  File "C:\Python27\Lib\dateutil\parser.py", line 24, in <module>
    from six import text_type, binary_type, integer_types
ImportError: No module named six

能告诉我six模块是什么以及如何在Windows 7机器上安装它?

这是六个是什么:

pip search six
six                       - Python 2 and 3 compatibility utilities

安装:

pip install six

虽然如果你从pip安装python-dateutil六应该被设置为依赖。

注意:从命令行安装pip run easy_install pip

你需要安装它

https://pypi.python.org/pypi/six

如果你还不知道pip是什么,那么请google for pip install

Python拥有自己的包管理器,可以帮助您查找包及其依赖项: http//www.pip-installer.org/en/latest/

我对macOS有同样的问题。

但根本原因不是安装Six。 我的macOS发布的Python版本2.7被我通过brew安装包继承的Python2版本篡夺。

我修复了我的问题: $ brew uninstall python@2

这里有一些背景: https://bugs.swift.org/browse/SR-1061https://bugs.swift.org/browse/SR-1061

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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