在 python 中安装 dialogflow 时出错

Getting error installing dialogflow in python

我确实在 window 10 和 运行

中安装了最新的 python(v3.9 32 位版本)

pip install dialogflow

我在我的控制台中收到以下 rrror 详细信息。

 ERROR: Command errored out with exit status 1:
   command: 'E:\projs\mine\py\trydialogflow\env\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\xxx\AppData\Local\Temp\pip-install-obzejx0c\grpcio\setup.py'"'"'; __file__='"'"'C:\Users\xxx\AppData\Local\Temp\pip-install-obzejx0c\grpcio\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\xxx\AppData\Local\Temp\pip-wheel-uf8sk7bc'
       cwd: C:\Users\xxx\AppData\Local\Temp\pip-install-obzejx0c\grpcio\
  Complete output (79 lines):
  ASM Builds for BoringSSL currently not supported on: win32
  Found cython-generated files...
  running bdist_wheel
  running build
  running build_py
  running build_project_metadata
  creating python_build
  creating python_build\lib.win32-3.9
  creating python_build\lib.win32-3.9\grpc
  copying src\python\grpcio\grpc\_auth.py -> python_build\lib.win32-3.9\grpc
  copying src\python\grpcio\grpc\_channel.py -> python_build\lib.win32-3.9\grpc
  copying src\python\grpcio\grpc\_common.py -> python_build\lib.win32-3.9\grpc
  copying src\python\grpcio\grpc\_compression.py -> python_build\lib.win32-3.9\grpc
  copying src\python\grpcio\grpc\_grpcio_metadata.py -> python_build\lib.win32-3.9\grpc
  copying src\python\grpcio\grpc\_interceptor.py -> python_build\lib.win32-3.9\grpc
  copying src\python\grpcio\grpc\_plugin_wrapping.py -> python_build\lib.win32-3.9\grpc
  copying src\python\grpcio\grpc\_runtime_protos.py -> python_build\lib.win32-3.9\grpc
  copying src\python\grpcio\grpc\_server.py -> python_build\lib.win32-3.9\grpc
  copying src\python\grpcio\grpc\_simple_stubs.py -> python_build\lib.win32-3.9\grpc
  copying src\python\grpcio\grpc\_utilities.py -> python_build\lib.win32-3.9\grpc
  copying src\python\grpcio\grpc\__init__.py -> python_build\lib.win32-3.9\grpc
  creating python_build\lib.win32-3.9\grpc\aio
  copying src\python\grpcio\grpc\aio\_base_call.py -> python_build\lib.win32-3.9\grpc\aio
  copying src\python\grpcio\grpc\aio\_base_channel.py -> python_build\lib.win32-3.9\grpc\aio
  copying src\python\grpcio\grpc\aio\_base_server.py -> python_build\lib.win32-3.9\grpc\aio
  copying src\python\grpcio\grpc\aio\_call.py -> python_build\lib.win32-3.9\grpc\aio
  copying src\python\grpcio\grpc\aio\_channel.py -> python_build\lib.win32-3.9\grpc\aio
  copying src\python\grpcio\grpc\aio\_interceptor.py -> python_build\lib.win32-3.9\grpc\aio
  copying src\python\grpcio\grpc\aio\_metadata.py -> python_build\lib.win32-3.9\grpc\aio
  copying src\python\grpcio\grpc\aio\_server.py -> python_build\lib.win32-3.9\grpc\aio
  copying src\python\grpcio\grpc\aio\_typing.py -> python_build\lib.win32-3.9\grpc\aio
  copying src\python\grpcio\grpc\aio\_utils.py -> python_build\lib.win32-3.9\grpc\aio
  copying src\python\grpcio\grpc\aio\__init__.py -> python_build\lib.win32-3.9\grpc\aio
  creating python_build\lib.win32-3.9\grpc\beta
  copying src\python\grpcio\grpc\beta\implementations.py -> python_build\lib.win32-3.9\grpc\beta
  copying src\python\grpcio\grpc\beta\interfaces.py -> python_build\lib.win32-3.9\grpc\beta
  copying src\python\grpcio\grpc\beta\utilities.py -> python_build\lib.win32-3.9\grpc\beta
  copying src\python\grpcio\grpc\beta\_client_adaptations.py -> python_build\lib.win32-3.9\grpc\beta
  copying src\python\grpcio\grpc\beta\_metadata.py -> python_build\lib.win32-3.9\grpc\beta
  copying src\python\grpcio\grpc\beta\_server_adaptations.py -> python_build\lib.win32-3.9\grpc\beta
  copying src\python\grpcio\grpc\beta\__init__.py -> python_build\lib.win32-3.9\grpc\beta
  creating python_build\lib.win32-3.9\grpc\experimental
  copying src\python\grpcio\grpc\experimental\gevent.py -> python_build\lib.win32-3.9\grpc\experimental
  copying src\python\grpcio\grpc\experimental\session_cache.py -> python_build\lib.win32-3.9\grpc\experimental
  copying src\python\grpcio\grpc\experimental\__init__.py -> python_build\lib.win32-3.9\grpc\experimental
  creating python_build\lib.win32-3.9\grpc\framework
  copying src\python\grpcio\grpc\framework\__init__.py -> python_build\lib.win32-3.9\grpc\framework
  creating python_build\lib.win32-3.9\grpc\_cython
  copying src\python\grpcio\grpc\_cython\__init__.py -> python_build\lib.win32-3.9\grpc\_cython
  creating python_build\lib.win32-3.9\grpc\experimental\aio
  copying src\python\grpcio\grpc\experimental\aio\__init__.py -> python_build\lib.win32-3.9\grpc\experimental\aio
  creating python_build\lib.win32-3.9\grpc\framework\common
  copying src\python\grpcio\grpc\framework\common\cardinality.py -> python_build\lib.win32-3.9\grpc\framework\common
  copying src\python\grpcio\grpc\framework\common\style.py -> python_build\lib.win32-3.9\grpc\framework\common
  copying src\python\grpcio\grpc\framework\common\__init__.py -> python_build\lib.win32-3.9\grpc\framework\common
  creating python_build\lib.win32-3.9\grpc\framework\foundation
  copying src\python\grpcio\grpc\framework\foundation\abandonment.py -> python_build\lib.win32-3.9\grpc\framework\foundation
  copying src\python\grpcio\grpc\framework\foundation\callable_util.py -> python_build\lib.win32-3.9\grpc\framework\foundation
  copying src\python\grpcio\grpc\framework\foundation\future.py -> python_build\lib.win32-3.9\grpc\framework\foundation
  copying src\python\grpcio\grpc\framework\foundation\logging_pool.py -> python_build\lib.win32-3.9\grpc\framework\foundation
  copying src\python\grpcio\grpc\framework\foundation\stream.py -> python_build\lib.win32-3.9\grpc\framework\foundation
  copying src\python\grpcio\grpc\framework\foundation\stream_util.py -> python_build\lib.win32-3.9\grpc\framework\foundation
  copying src\python\grpcio\grpc\framework\foundation\__init__.py -> python_build\lib.win32-3.9\grpc\framework\foundation
  creating python_build\lib.win32-3.9\grpc\framework\interfaces
  copying src\python\grpcio\grpc\framework\interfaces\__init__.py -> python_build\lib.win32-3.9\grpc\framework\interfaces
  creating python_build\lib.win32-3.9\grpc\framework\interfaces\base
  copying src\python\grpcio\grpc\framework\interfaces\base\base.py -> python_build\lib.win32-3.9\grpc\framework\interfaces\base
  copying src\python\grpcio\grpc\framework\interfaces\base\utilities.py -> python_build\lib.win32-3.9\grpc\framework\interfaces\base
  copying src\python\grpcio\grpc\framework\interfaces\base\__init__.py -> python_build\lib.win32-3.9\grpc\framework\interfaces\base
  creating python_build\lib.win32-3.9\grpc\framework\interfaces\face
  copying src\python\grpcio\grpc\framework\interfaces\face\face.py -> python_build\lib.win32-3.9\grpc\framework\interfaces\face
  copying src\python\grpcio\grpc\framework\interfaces\face\utilities.py -> python_build\lib.win32-3.9\grpc\framework\interfaces\face
  copying src\python\grpcio\grpc\framework\interfaces\face\__init__.py -> python_build\lib.win32-3.9\grpc\framework\interfaces\face
  creating python_build\lib.win32-3.9\grpc\_cython\_cygrpc
  copying src\python\grpcio\grpc\_cython\_cygrpc\__init__.py -> python_build\lib.win32-3.9\grpc\_cython\_cygrpc
  creating python_build\lib.win32-3.9\grpc\_cython\_credentials
  copying src\python\grpcio\grpc\_cython\_credentials\roots.pem -> python_build\lib.win32-3.9\grpc\_cython\_credentials
  running build_ext
  error: [WinError 2] The system cannot find the file specified
  ----------------------------------------
  ERROR: Failed building wheel for grpcio
  Running setup.py clean for grpcio
Failed to build grpcio
Installing collected packages: grpcio, google-api-core, dialogflow
    Running setup.py install for grpcio ... error
    ERROR: Command errored out with exit status 1:
     command: 'E:\projs\mine\py\trydialogflow\env\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\xxx\AppData\Local\Temp\pip-install-obzejx0c\grpcio\setup.py'"'"'; __file__='"'"'C:\Users\xxx\AppData\Local\Temp\pip-install-obzejx0c\grpcio\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\xxx\AppData\Local\Temp\pip-record-xpr2w8h_\install-record.txt' --single-version-externally-managed --compile --install-headers 'E:\projs\mine\py\trydialogflow\env\include\site\python3.9\grpcio'
         cwd: C:\Users\xxx\AppData\Local\Temp\pip-install-obzejx0c\grpcio\
    Complete output (83 lines):
    ASM Builds for BoringSSL currently not supported on: win32
    Cython-generated files are missing...
    Compiling src\python\grpcio\grpc/_cython/cygrpc.pyx because it changed.
    [1/1] Cythonizing src\python\grpcio\grpc/_cython/cygrpc.pyx
    E:\projs\mine\py\trydialogflow\env\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\xxx\AppData\Local\Temp\pip-install-obzejx0c\grpcio\src\python\grpcio\grpc\_cython\cygrpc.pxd
      tree = Parsing.p_module(s, pxd, full_module_name)
    running install
    running build
    running build_py
    running build_project_metadata
    creating python_build
    creating python_build\lib.win32-3.9
    creating python_build\lib.win32-3.9\grpc
    copying src\python\grpcio\grpc\_auth.py -> python_build\lib.win32-3.9\grpc
    copying src\python\grpcio\grpc\_channel.py -> python_build\lib.win32-3.9\grpc
    copying src\python\grpcio\grpc\_common.py -> python_build\lib.win32-3.9\grpc
    copying src\python\grpcio\grpc\_compression.py -> python_build\lib.win32-3.9\grpc
    copying src\python\grpcio\grpc\_grpcio_metadata.py -> python_build\lib.win32-3.9\grpc
    copying src\python\grpcio\grpc\_interceptor.py -> python_build\lib.win32-3.9\grpc
    copying src\python\grpcio\grpc\_plugin_wrapping.py -> python_build\lib.win32-3.9\grpc
    copying src\python\grpcio\grpc\_runtime_protos.py -> python_build\lib.win32-3.9\grpc
    copying src\python\grpcio\grpc\_server.py -> python_build\lib.win32-3.9\grpc
    copying src\python\grpcio\grpc\_simple_stubs.py -> python_build\lib.win32-3.9\grpc
    copying src\python\grpcio\grpc\_utilities.py -> python_build\lib.win32-3.9\grpc
    copying src\python\grpcio\grpc\__init__.py -> python_build\lib.win32-3.9\grpc
    creating python_build\lib.win32-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_base_call.py -> python_build\lib.win32-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_base_channel.py -> python_build\lib.win32-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_base_server.py -> python_build\lib.win32-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_call.py -> python_build\lib.win32-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_channel.py -> python_build\lib.win32-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_interceptor.py -> python_build\lib.win32-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_metadata.py -> python_build\lib.win32-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_server.py -> python_build\lib.win32-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_typing.py -> python_build\lib.win32-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_utils.py -> python_build\lib.win32-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\__init__.py -> python_build\lib.win32-3.9\grpc\aio
    creating python_build\lib.win32-3.9\grpc\beta
    copying src\python\grpcio\grpc\beta\implementations.py -> python_build\lib.win32-3.9\grpc\beta
    copying src\python\grpcio\grpc\beta\interfaces.py -> python_build\lib.win32-3.9\grpc\beta
    copying src\python\grpcio\grpc\beta\utilities.py -> python_build\lib.win32-3.9\grpc\beta
    copying src\python\grpcio\grpc\beta\_client_adaptations.py -> python_build\lib.win32-3.9\grpc\beta
    copying src\python\grpcio\grpc\beta\_metadata.py -> python_build\lib.win32-3.9\grpc\beta
    copying src\python\grpcio\grpc\beta\_server_adaptations.py -> python_build\lib.win32-3.9\grpc\beta
    copying src\python\grpcio\grpc\beta\__init__.py -> python_build\lib.win32-3.9\grpc\beta
    creating python_build\lib.win32-3.9\grpc\experimental
    copying src\python\grpcio\grpc\experimental\gevent.py -> python_build\lib.win32-3.9\grpc\experimental
    copying src\python\grpcio\grpc\experimental\session_cache.py -> python_build\lib.win32-3.9\grpc\experimental
    copying src\python\grpcio\grpc\experimental\__init__.py -> python_build\lib.win32-3.9\grpc\experimental
    creating python_build\lib.win32-3.9\grpc\framework
    copying src\python\grpcio\grpc\framework\__init__.py -> python_build\lib.win32-3.9\grpc\framework
    creating python_build\lib.win32-3.9\grpc\_cython
    copying src\python\grpcio\grpc\_cython\__init__.py -> python_build\lib.win32-3.9\grpc\_cython
    creating python_build\lib.win32-3.9\grpc\experimental\aio
    copying src\python\grpcio\grpc\experimental\aio\__init__.py -> python_build\lib.win32-3.9\grpc\experimental\aio
    creating python_build\lib.win32-3.9\grpc\framework\common
    copying src\python\grpcio\grpc\framework\common\cardinality.py -> python_build\lib.win32-3.9\grpc\framework\common
    copying src\python\grpcio\grpc\framework\common\style.py -> python_build\lib.win32-3.9\grpc\framework\common
    copying src\python\grpcio\grpc\framework\common\__init__.py -> python_build\lib.win32-3.9\grpc\framework\common
    creating python_build\lib.win32-3.9\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\abandonment.py -> python_build\lib.win32-3.9\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\callable_util.py -> python_build\lib.win32-3.9\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\future.py -> python_build\lib.win32-3.9\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\logging_pool.py -> python_build\lib.win32-3.9\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\stream.py -> python_build\lib.win32-3.9\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\stream_util.py -> python_build\lib.win32-3.9\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\__init__.py -> python_build\lib.win32-3.9\grpc\framework\foundation
    creating python_build\lib.win32-3.9\grpc\framework\interfaces
    copying src\python\grpcio\grpc\framework\interfaces\__init__.py -> python_build\lib.win32-3.9\grpc\framework\interfaces
    creating python_build\lib.win32-3.9\grpc\framework\interfaces\base
    copying src\python\grpcio\grpc\framework\interfaces\base\base.py -> python_build\lib.win32-3.9\grpc\framework\interfaces\base
    copying src\python\grpcio\grpc\framework\interfaces\base\utilities.py -> python_build\lib.win32-3.9\grpc\framework\interfaces\base
    copying src\python\grpcio\grpc\framework\interfaces\base\__init__.py -> python_build\lib.win32-3.9\grpc\framework\interfaces\base
    creating python_build\lib.win32-3.9\grpc\framework\interfaces\face
    copying src\python\grpcio\grpc\framework\interfaces\face\face.py -> python_build\lib.win32-3.9\grpc\framework\interfaces\face
    copying src\python\grpcio\grpc\framework\interfaces\face\utilities.py -> python_build\lib.win32-3.9\grpc\framework\interfaces\face
    copying src\python\grpcio\grpc\framework\interfaces\face\__init__.py -> python_build\lib.win32-3.9\grpc\framework\interfaces\face
    creating python_build\lib.win32-3.9\grpc\_cython\_cygrpc
    copying src\python\grpcio\grpc\_cython\_cygrpc\__init__.py -> python_build\lib.win32-3.9\grpc\_cython\_cygrpc
    creating python_build\lib.win32-3.9\grpc\_cython\_credentials
    copying src\python\grpcio\grpc\_cython\_credentials\roots.pem -> python_build\lib.win32-3.9\grpc\_cython\_credentials
    running build_ext
    error: [WinError 2] The system cannot find the file specified
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'E:\projs\mine\py\trydialogflow\env\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\xxx\AppData\Local\Temp\pip-install-obzejx0c\grpcio\setup.py'"'"'; __file__='"'"'C:\Users\xxx\AppData\Local\Temp\pip-install-obzejx0c\grpcio\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\xxx\AppData\Local\Temp\pip-record-xpr2w8h_\install-record.txt' --single-version-externally-managed --compile --install-headers 'E:\projs\mine\py\trydialogflow\env\include\site\python3.9\grpcio' Check the logs for full command output.

pip freeze输出

cachetools==4.1.1
certifi==2020.6.20
chardet==3.0.4
Cython==0.29.21
google-auth==1.22.1
googleapis-common-protos==1.52.0
idna==2.10
protobuf==3.13.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pytz==2020.1
requests==2.24.0
rsa==4.6
six==1.15.0
urllib3==1.25.11

我对 python 和 pip 还很陌生,不知道我是否遗漏了什么。 任何建议都会很有帮助,谢谢。

使用 python 版本 <=3.7 似乎可以解决我的问题。

这post 有帮助

https://github.com/grpc/grpc/issues/20604