Mac pip install protobuf 安装失败

2017-6-12 杜世伟 Mac

Installing collected packages: six, protobuf
  Found existing installation: six 1.4.1
    DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
  File "/Users/xiaodu/Library/Python/2.7/lib/python/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Users/xiaodu/Library/Python/2.7/lib/python/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Users/xiaodu/Library/Python/2.7/lib/python/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)

阅读全文>>

标签: protobuf python pip

评论(0) 浏览(4774)

Protobuf proto3 与 proto2 区别

2015-8-21 杜世伟 Linux

这是一篇学习笔记。在粗略的看了 Protobuf 的文档中关于 proto2 和 proto3 的说明后,记录下了几点 proto3 区别于 proto2 的地方。

总的来说,proto3 比 proto2 支持更多语言但 更简洁。去掉了一些复杂的语法和特性,更强调约定而弱化语法。如果是首次使用 Protobuf ,建议使用 proto3 。

1)在第一行非空白非注释行,必须写:

syntax = "proto3";

2)字段规则移除了 “required”,并把 “optional” 改名为 “singular”1;

在 proto2 中 required 也是不推荐使用的。proto3 直接从语法层面上移除了 required 规则。其实可以做的更彻底,把所有字段规则描述都撤销,原来的 repeated 改为在类型或字段名后加一对中括号。这样是不是更简洁?

阅读全文>>

标签: linux json protobuf

评论(0) 浏览(12816)

protobuf 语法简介

2014-8-13 杜世伟 Php

1.基本语义

在.proto文件中,最基本的数据类型为message,如其定义所示,由message引导,之后是message类型的名字,之后是由{}包含的各个域(fields)。

required string name = 1; 域字义的一个例子。

required 表示这个域是必需的

optional 该域选,出现0次或1次

repeated 重复出现,0次或多次

阅读全文>>

标签: PHP protobuf

评论(0) 浏览(5056)

Powered by emlog 沪ICP备2023034538号-1