安装caffe时遇到这个错误,如下图所示:

在编译caffe过程中遇到的问题:libboost_python.so: undefined reference to `PyUnicode_InternFromString'

简单粗暴的解决办法,进入到libboost_python.so所在root,删除当前的libboost_python.so,再重新生成新的链接

cd /usr/lib/x86_64-linux-gnu/
sudo rm libboost_python.so
sudo ln -s libboost_python-py27.so libboost_python.so

解决问题。

重新编译,记得先clean,再编译!

在编译caffe过程中遇到的问题:libboost_python.so: undefined reference to `PyUnicode_InternFromString'

编译成功。 

如果上述方法没有解决,查看你cmake编译时python版本,

在编译caffe过程中遇到的问题:libboost_python.so: undefined reference to `PyUnicode_InternFromString' 

如果cmake配置的是anaconda中的python,也会出现上述错误,修改环境变量,将python版本替换为自己配置的python如下:

(1)sudo gedit .bashrc

(2)注释:

__conda_setup="$('/home/whf/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/whf/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/home/whf/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/whf/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup

在底部添加你的python所在位置:

PATH="/usr/lib/python3.5/site-packages:${PATH}"
export PATH
PYTHONPATH="/usr/lib/python3.5/site-packages:${PATH}"
export PYTHONPATH

重新打开终端编译,如下图所示,修改成功:

在编译caffe过程中遇到的问题:libboost_python.so: undefined reference to `PyUnicode_InternFromString'

再进行编译,成功!

 

相关文章:

  • 2021-07-27
  • 2021-05-16
  • 2022-12-23
  • 2022-01-01
  • 2021-09-07
  • 2022-12-23
  • 2021-11-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-25
  • 2021-12-29
  • 2022-02-28
  • 2021-06-04
  • 2021-11-01
相关资源
相似解决方案