[英]How do I add a 'google' module for protocol buffers in Python in Visual Studio 2013?
我正在https://developers.google.com/protocol-buffers/docs/pythontutorial上關注該教程。
我已經設法從原始文件創建addressbook_pb2.py
。 我將addressbook_pb2.py
添加到我的項目中,當我import addressbook_pb2
在鍵入名稱時會彈出.py文件,因此我知道程序可以識別它。
當我嘗試運行僅由import addressbook_pb2
行import addressbook_pb2
組成的程序時,出現錯誤No module named 'google'
。 我是Python的新手,我將如何解決該錯誤? 我在Visual Studio 2013中運行Python 3.4
該錯誤是由於我的“ addressbook_pb2.py”文件中的每個importing google.protobuf
行引起的
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: addressbook.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.