pkg_resources DistributionNotFound grpcio not found

2024-05-28 18:51:04 发布

您现在位置:Python中文网/ 问答频道 /正文

Traceback (most recent call last):
  File "txt_img.py", line 4, in <module>
    from google.cloud import vision
  File "/home/ram/.local/lib/python2.7/site-packages/google/cloud/vision.py", line 20, in <module>
    from google.cloud.vision_v1 import enums
  File "/home/ram/.local/lib/python2.7/site-packages/google/cloud/vision_v1/__init__.py", line 22, in <module>
    from google.cloud.vision_v1.gapic import image_annotator_client as iac
  File "/home/ram/.local/lib/python2.7/site-packages/google/cloud/vision_v1/gapic/image_annotator_client.py", line 18, in <module>
    import google.api_core.gapic_v1.client_info
  File "/home/ram/.local/lib/python2.7/site-packages/google/api_core/gapic_v1/__init__.py", line 15, in <module>
    from google.api_core.gapic_v1 import client_info
  File "/home/ram/.local/lib/python2.7/site-packages/google/api_core/gapic_v1/client_info.py", line 26, in <module>
    _GRPC_VERSION = pkg_resources.get_distribution('grpcio').version
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 344, in get_distribution
    if isinstance(dist,Requirement): dist = get_provider(dist)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 223, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 725, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/enter code herepython2.7/dist-packages/pkg_resources.py", line 628, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: grpcio

当我安装grpcio时

^{pr2}$

然后给出如下错误:

pip can't proceed with requirement 'grpcio' due to a pre-existing build directory.
 location: /tmp/pip_build_ram/grpcio
This is likely due to a previous installation that failed.
pip is being responsible and not assuming it can delete this.
Please delete it and try again.

Storing debug log for failure in /tmp/tmpDEmkZc

我删除了“/tmp/pip_build\u ram/grpcio”,然后再试了一次,但没有起作用。在


Tags: inpycloudlibpackagesdistgoogleline

热门问题