[英]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-1061
: https://bugs.swift.org/browse/SR-1061
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.