[Mac] gsutil 遇到 Enum not defined 錯誤

[Mac] gsutil 遇到 Enum not defined 錯誤

Google 的 gsutil 在我的 Mac 上真的是很常遇到問題…

前幾天遇到了 httplib2 版本過舊的問題

今天遇到的是 Enum not defined:

testuser@localhost ~ $ gsutil
Traceback (most recent call last):
File "/usr/local/bin/gsutil", line 9, in <module>
load_entry_point('gsutil==4.13', 'console_scripts', 'gsutil')()
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 558, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
return ep.load()
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 2361, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Library/Python/2.7/site-packages/gslib/__main__.py", line 53, in <module>
from gslib import wildcard_iterator
File "/Library/Python/2.7/site-packages/gslib/wildcard_iterator.py", line 37, in <module>
from gslib.translation_helper import GenerationFromUrlAndString
File "/Library/Python/2.7/site-packages/gslib/translation_helper.py", line 25, in <module>
from apitools.base.py import encoding
File "/Library/Python/2.7/site-packages/apitools/base/py/__init__.py", line 5, in <module>
from apitools.base.py.base_api import *
File "/Library/Python/2.7/site-packages/apitools/base/py/base_api.py", line 10, in <module>
from protorpc import message_types
File "/Library/Python/2.7/site-packages/protorpc/message_types.py", line 28, in <module>
from . import messages
File "/Library/Python/2.7/site-packages/protorpc/messages.py", line 398, in <module>
class Enum(six.with_metaclass(_EnumClass, object)):
File "/Library/Python/2.7/site-packages/protorpc/messages.py", line 300, in __init__
if not (bases == (object,) or bases == (Enum,)):
NameError: global name 'Enum' is not defined

 

後來在 gsutil 論壇上找到這篇 NameError from protorpc happen in 4.12

說是 easy_install 裝的 six 模組比較舊,把 pip 裝的新模組遮蓋掉了,

testuser@localhost ~ $ python
>>> import six
>>> six.__version__
'1.4.1'
testuser@localhost ~ $ pip show six
Metadata-Version: 2.0
Name: six
Version: 1.9.0
Summary: Python 2 and 3 compatibility utilities
Home-page: http://pypi.python.org/pypi/six/
Author: Benjamin Peterson
Author-email: [email protected]
License: MIT
Location: /Library/Python/2.7/site-packages
Requires:

 

還沒研究,不曉得 easy_install 和 pip 安裝的各別安裝到哪去了…

照著它上面的解法,用 easy_install 把 six 模組也升到最新版:

sudo easy_install -U six

 

果真問題就解決了~~ 有空再來研究一下 easy_install 和 pip 吧 XD

(本頁面已被瀏覽過 174 次)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料