tensorflow 与protobuf版本对应问题
·
tensorflow 与protobuf版本对应问题
问题描述
我在前面的文章编译了tensorflow 2.4.1
版本, 然后随之又根据protobuf github教程安装了3.15
版本的protobuf
当我在编译代码引入tensorflow 时 提示如下错误:
当我运行如下命令; 得到protoc的位置,和版本信息
siz@ubuntu:~$ which protoc
/usr/local/bin/protoc
siz@ubuntu:~$ protoc --version
libprotoc 3.15.8
查阅博客得到如下信息:
(参考链接: https://blog.csdn.net/datase/article/details/82347834)
我想我遇到的应该是第二个问题:
所以我去了tensorflow github 查看了 workspace.bzl 信息: 对应的 protobuf的版本为3.9.2
;
尝试解决
卸载 protobuf
Note! 因为之前第一次安装protobuf 采用的是覆盖安装,所以将Ubuntu自带的protobuf覆盖掉了, 所以我选择直接卸载掉最新的,重新安装,没有采用兼容安装的方式
删除方式, 进入到下载的protobuf 路径里, 采用 make uninstall 方式
siz@ubuntu:~/soft$ cd protobuf-3.15.8/
siz@ubuntu:~/soft/protobuf-3.15.8$ sudo make uninstall
[sudo] password for siz:
Making uninstall in .
make[1]: Entering directory '/home/siz/soft/protobuf-3.15.8'
( cd '/usr/local/lib/pkgconfig' && rm -f protobuf.pc protobuf-lite.pc )
make[1]: Leaving directory '/home/siz/soft/protobuf-3.15.8'
Making uninstall in src
make[1]: Entering directory '/home/siz/soft/protobuf-3.15.8/src'
( cd '/usr/local/bin' && rm -f protoc )
/bin/bash ../libtool --mode=uninstall rm -f '/usr/local/lib/libprotobuf-lite.la'
libtool: uninstall: rm -f /usr/local/lib/libprotobuf-lite.la /usr/local/lib/libprotobuf-lite.a
/bin/bash ../libtool --mode=uninstall rm -f '/usr/local/lib/libprotobuf.la'
libtool: uninstall: rm -f /usr/local/lib/libprotobuf.la /usr/local/lib/libprotobuf.a
/bin/bash ../libtool --mode=uninstall rm -f '/usr/local/lib/libprotoc.la'
libtool: uninstall: rm -f /usr/local/lib/libprotoc.la /usr/local/lib/libprotoc.a
( cd '/usr/local/include' && rm -f google/protobuf/descriptor.proto google/protobuf/any.proto google/protobuf/api.proto google/protobuf/duration.proto google/protobuf/empty.proto google/protobuf/field_mask.proto google/protobuf/source_context.proto google/protobuf/struct.proto google/protobuf/timestamp.proto google/protobuf/type.proto google/protobuf/wrappers.proto google/protobuf/compiler/plugin.proto )
( cd '/usr/local/include' && rm -f google/protobuf/stubs/callback.h google/protobuf/stubs/bytestream.h google/protobuf/stubs/casts.h google/protobuf/stubs/common.h google/protobuf/stubs/hash.h google/protobuf/stubs/logging.h google/protobuf/stubs/macros.h google/protobuf/stubs/map_util.h google/protobuf/stubs/mutex.h google/protobuf/stubs/once.h google/protobuf/stubs/platform_macros.h google/protobuf/stubs/port.h google/protobuf/stubs/status.h google/protobuf/stubs/stl_util.h google/protobuf/stubs/stringpiece.h google/protobuf/stubs/strutil.h google/protobuf/stubs/template_util.h google/protobuf/any.pb.h google/protobuf/api.pb.h google/protobuf/any.h google/protobuf/arena.h google/protobuf/arena_impl.h google/protobuf/arenastring.h google/protobuf/descriptor_database.h google/protobuf/descriptor.h google/protobuf/descriptor.pb.h google/protobuf/duration.pb.h google/protobuf/dynamic_message.h google/protobuf/empty.pb.h google/protobuf/extension_set.h google/protobuf/extension_set_inl.h google/protobuf/field_mask.pb.h google/protobuf/generated_enum_reflection.h google/protobuf/generated_enum_util.h google/protobuf/generated_message_reflection.h google/protobuf/generated_message_table_driven.h google/protobuf/generated_message_util.h google/protobuf/has_bits.h google/protobuf/implicit_weak_message.h google/protobuf/io/io_win32.h google/protobuf/map_entry.h google/protobuf/map_entry_lite.h google/protobuf/map_field.h google/protobuf/map_field_inl.h google/protobuf/map_field_lite.h google/protobuf/map.h google/protobuf/map_type_handler.h google/protobuf/message.h google/protobuf/message_lite.h google/protobuf/metadata.h google/protobuf/metadata_lite.h google/protobuf/parse_context.h google/protobuf/port.h google/protobuf/port_def.inc google/protobuf/port_undef.inc google/protobuf/reflection.h google/protobuf/reflection_ops.h google/protobuf/repeated_field.h google/protobuf/service.h google/protobuf/source_context.pb.h google/protobuf/struct.pb.h google/protobuf/text_format.h google/protobuf/timestamp.pb.h google/protobuf/type.pb.h google/protobuf/unknown_field_set.h google/protobuf/wire_format.h google/protobuf/wire_format_lite.h google/protobuf/wrappers.pb.h google/protobuf/io/coded_stream.h google/protobuf/io/gzip_stream.h google/protobuf/io/printer.h google/protobuf/io/strtod.h google/protobuf/io/tokenizer.h google/protobuf/io/zero_copy_stream.h google/protobuf/io/zero_copy_stream_impl.h google/protobuf/io/zero_copy_stream_impl_lite.h google/protobuf/compiler/code_generator.h google/protobuf/compiler/command_line_interface.h google/protobuf/compiler/importer.h google/protobuf/compiler/parser.h google/protobuf/compiler/plugin.h google/protobuf/compiler/plugin.pb.h google/protobuf/compiler/cpp/cpp_generator.h google/protobuf/compiler/csharp/csharp_generator.h google/protobuf/compiler/csharp/csharp_names.h google/protobuf/compiler/java/java_generator.h google/protobuf/compiler/java/java_names.h google/protobuf/compiler/js/js_generator.h google/protobuf/compiler/js/well_known_types_embed.h google/protobuf/compiler/objectivec/objectivec_generator.h google/protobuf/compiler/objectivec/objectivec_helpers.h google/protobuf/compiler/php/php_generator.h google/protobuf/compiler/python/python_generator.h google/protobuf/compiler/ruby/ruby_generator.h google/protobuf/util/type_resolver.h google/protobuf/util/delimited_message_util.h google/protobuf/util/field_comparator.h google/protobuf/util/field_mask_util.h google/protobuf/util/json_util.h google/protobuf/util/time_util.h google/protobuf/util/type_resolver_util.h google/protobuf/util/message_differencer.h )
make[1]: Leaving directory '/home/siz/soft/protobuf-3.15.8/src'
siz@ubuntu:~/soft/protobuf-3.15.8$ which protoc
siz@ubuntu:~/soft/protobuf-3.15.8$
重新安装protobuf
protobuf github release 地址: https://github.com/protocolbuffers/protobuf/releases
下载对应的3.92
版本: 并解压
cd protobuf-XXX/
./autogen.sh
./configure
make
make check
sudo make install
sudo ldconfig # refresh shared library cache.
查看版本 protoc --version
至此安装完成
更多推荐
已为社区贡献3条内容
所有评论(0)