每当我向GoogleVision api请求时,都会弹出此错误消息。甚至无法安装/卸载任何软件包
示例输出:
engineer@engineer:~$ sudo pip install --upgrade google-cloud
工程师的[sudo]密码: 回溯(最近一次调用最后一次):
File "/usr/local/bin/pip", line 7, in <module>
from pip import main
File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/local/lib/python2.7/dist-packages/pip/utils/__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in <module>
@_call_aside
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set
dist.activate(replace=False)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate
declare_namespace(pkg)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace
_handle_ns(packageName, path_item)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2091, in _handle_ns
loader.load_module(packageName)
File "/usr/lib/python2.7/pkgutil.py", line 246, in load_module
mod = imp.load_module(fullname, self.file, self.filename, self.etc)
File "/home/engineer/.local/lib/python2.7/site-packages/google/cloud/logging/__init__.py", line 18, in <module>
from pkg_resources import get_distribution
File "/home/engineer/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3036, in <module>
@_call_aside
File "/home/engineer/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3020, in _call_aside
f(*args, **kwargs)
File "/home/engineer/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3064, in _initialize_master_working_set
for dist in working_set
File "/home/engineer/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3064, in <genexpr>
for dist in working_set
File "/home/engineer/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2594, in activate
declare_namespace(pkg)
File "/home/engineer/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2162, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/engineer/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2097, in _handle_ns
loader.load_module(packageName)
File "/usr/lib/python2.7/pkgutil.py", line 246, in load_module
mod = imp.load_module(fullname, self.file, self.filename, self.etc)
File "/usr/local/lib/python2.7/dist-packages/google/cloud/logging/__init__.py", line 18, in <module>
from google.cloud.logging.client import Client
File "/usr/local/lib/python2.7/dist-packages/google/cloud/logging/client.py", line 32, in <module>
from google.cloud.client import JSONClient
ImportError:无法导入名称JSONClient
答案 0 :(得分:3)
我今天遇到0.24.0版的同样问题, 我现在已经将google-cloud降级到0.23.0, pip install --upgrade google-cloud == 0.23.0 它的工作