无法导入名称locked_file

时间:2017-07-12 19:08:33

标签: python python-2.7 oauth-2.0 google-oauth google-client

我试图在我的机器上使用gsutil,但我不能,这是错误:

cannot import name locked_file

我使用的是linux,python 2.7,gsutil 4.20和oauth2client 4.0

这是错误追溯:

# gsutil 
Traceback (most recent call last):
File "/usr/lib/python-exec/python2.7/gsutil", line 11, in <module>
load_entry_point('gsutil==4.20', 'console_scripts', 'gsutil')()
File "/usr/lib64/python2.7/site-packages/pkg_resources/__init__.py", line 
561, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib64/python2.7/site-packages/pkg_resources/__init__.py", line 
2627, in load_entry_point
return ep.load()
File "/usr/lib64/python2.7/site-packages/pkg_resources/__init__.py", line 
2287, in load
return self.resolve()
File "/usr/lib64/python2.7/site-packages/pkg_resources/__init__.py", line 
2293, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib64/python2.7/site-packages/gslib/__main__.py", line 53, in 
<module>
from gslib import wildcard_iterator
File "/usr/lib64/python2.7/site-packages/gslib/wildcard_iterator.py", 
line 37, in <module>
from gslib.third_party.storage_apitools import storage_v1_messages as 
apitools_messages
File "/usr/lib64/python2.7/site-
packages/gslib/third_party/storage_apitools/storage_v1_messages.py", line 
22, in <module>
from apitools.base.py import encoding
File "/usr/lib64/python2.7/site-packages/apitools/base/py/__init__.py", 
line 22, in <module>
from apitools.base.py.credentials_lib import *
File "/usr/lib64/python2.7/site-
packages/apitools/base/py/credentials_lib.py", line 50, in <module>
from oauth2client import locked_file
ImportError: cannot import name locked_file

这是已安装的软件包:

[I] net-misc/gsutil
 Available versions:  ~3.42 ~4.19 (~)4.20 {PYTHON_TARGETS="python2_7"}
 Installed versions:  4.20

[I] dev-python/oauth2client
 Available versions:  1.5.2^t 2.0.1^t ~2.2.0^t (~)4.0.0^t {test PYTHON_TARGETS="pypy python2_7 python3_4 python3_5 python3_6"}
 Installed versions:  4.0.0^t

1 个答案:

答案 0 :(得分:0)

在这里找到答案 - 对我有用: https://github.com/GoogleCloudPlatform/gsutil/issues/442 (将oauth2client降级为2.2.0)