[英]Cannot import protobuf in conda env even though it's installed
在 Ubuntu 20.04 上,我无法导入protobuf
:
(r-torch) brucezepplin@brucezepplin-HP-ProBook-440-G7:~$ conda list | grep protobuf
libprotobuf 3.17.2 h4ff587b_1
protobuf 3.17.2 py39h295c915_0
(r-torch) brucezepplin@brucezepplin-HP-ProBook-440-G7:~$ python
Python 3.9.7 (default, Sep 16 2021, 13:09:58)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import protobuf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'protobuf'
有任何想法吗?
有同样的问题,我通过使用解决了它:
conda install protobuf
或者
pip install protobuf
protobuf 的 python package 具有使用google
作为根前缀的 package 结构:
import google.protobuf
from google.protobuf import <pkg-name>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.