用homebrew安装protobuf提示找不到包的解决办法

来源:互联网 发布:mac怎么下载wps office 编辑:程序博客网 时间:2024/05/17 23:03


用homebrew安装protobuf:


命令 brew install protobuf


命令执行之后:

安装位置: /usr/local/Cellar

软连接位置: /usr/local/lib/python2.7/site-packages


我安装protobuf时的提示:
Python modules have been installed and Homebrew's site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
please run:


  mkdir -p /Users/zj_macbook/Library/Python/2.7/lib/python/site-packages
  echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/zj_macbook/Library/Python/2.7/lib/python/site-packages/homebrew.pth


上面这些操作是创建了一个位于
/Users/zj_macbook/Library/Python/2.7/lib/python/site-packages
的文件
homebrew.pth
指向
/usr/local/lib/python2.7/site-packages
内容为:
import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")



这样做可以的原因是/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python这个python的sys.path的路径中有
/Users/zj_macbook/Library/Python/2.7/lib/python/site-packages
这一条路径


=======================================================
2 0
原创粉丝点击