没有名为api_core.protobuf_helpers的模块。python2.7和谷歌云

没有名为api_core.protobuf_helpers的模块。python2.7和谷歌云,python,python-2.7,google-cloud-speech,Python,Python 2.7,Google Cloud Speech,我正在尝试用语言自动检测来测试翻译 它与python3配合使用效果很好 但是,当尝试使用python2.7时,它会失败,并显示以下消息: python2.7 example.py multi-language Traceback (most recent call last): File "google_example.py", line 295, in <module> transcribe_file_with_multilanguage() File "googl

我正在尝试用语言自动检测来测试翻译

它与python3配合使用效果很好

但是,当尝试使用python2.7时,它会失败,并显示以下消息:

python2.7 example.py multi-language
Traceback (most recent call last):
  File "google_example.py", line 295, in <module>
    transcribe_file_with_multilanguage()
  File "google_example.py", line 214, in transcribe_file_with_multilanguage
    from google.cloud import speech_v1p1beta1 as speech
  File "/usr/local/lib/python2.7/dist-packages/google/cloud/speech_v1p1beta1/__init__.py", line 17, in <module>
    from google.cloud.speech_v1p1beta1 import types
  File "/usr/local/lib/python2.7/dist-packages/google/cloud/speech_v1p1beta1/types.py", line 20, in <module>
    from google.api_core.protobuf_helpers import get_messages
ImportError: No module named api_core.protobuf_helpers

程序包名称之间存在冲突。安装后,您的环境将尝试从中获取
api_core.protobuf_helpers
模块,而不是从
google api core
获取

要解决此问题,请采取以下方法。卸载
google
软件包并使用其他名称重新安装

还请注意,您使用的是。如果要使用当前稳定版本,请运行:

pip2 uninstall googleapis-common-protos
pip2 install googleapis-common-protos==1.5.8

谢谢大家!我按照建议卸载了所有google python模块。我按照以下顺序重新安装了它们。 我遵循的顺序是:

sudo pip2 install google 
sudo pip2 install google-api-core 
sudo pip2 install google-auth 
sudo pip2 install google-cloud-core 
sudo pip2 install google-cloud-speech 
sudo pip2 install googleapis-common-protos
现在它可以工作了: {


}

Python 2和Python 3的导入方式不同。您可以在中阅读更多关于它的信息。您可能正在使用
googlecloudspeech
库运行它。你能分享一下命令的结果吗?
pip2-freeze | grep-google
?为了Guido的缘故,停止使用
Python2.7
从第一个
Python3
版本发布到现在已经超过10年了。这是结果:google==2.0.2 google api core==1.8.0 google auth==1.6.3 google cloud core==0.29.1 google cloud speech==0.36.3 google Gleapis公共协议==1.6.0b9I很想使用Python3,但我还有其他选择只与python2.7一起工作的库,我不想进行系统调用,但所有内容都在python中。。。。
sudo pip2 install google 
sudo pip2 install google-api-core 
sudo pip2 install google-auth 
sudo pip2 install google-cloud-core 
sudo pip2 install google-cloud-speech 
sudo pip2 install googleapis-common-protos
python2.7 interpreter.py multi-language
Waiting for operation to complete...
--------------------
First alternative of result 0: transcript: "hello how are you"
confidence: 0.984296917915