美文网首页
anaconda3虚拟环境下报错ImportError: lib

anaconda3虚拟环境下报错ImportError: lib

作者: 吃醋不吃辣的雷儿 | 来源:发表于2022-06-15 10:58 被阅读0次

在import一个包时突然出现了这个报错:

ImportError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory

环境为anaconda3下python3.7版本的虚拟环境
以为是它没找到对应的python于是在第一行加了这么一句

#!/home/robot/anaconda3/envs/autonomousdriving/bin/python

但仍然于事无补
后面参考https://github.com/deepmind/acme/issues/47上Juze1500的回答

Hello! Try export LD_LIBRARY_PATH=/path/to/libpython/directory before executing your python script. 
If you are using Conda, the path should be /path/to/conda/envs/your_env/lib.

也就是在bashrc里加这么一句:

export LD_LIBRARY_PATH=/home/robot/anaconda3/envs/autonomousdriving/lib

之后

source ~/.bashrc

就好了,报错解决。

相关文章

网友评论

      本文标题:anaconda3虚拟环境下报错ImportError: lib

      本文链接:https://www.haomeiwen.com/subject/toqxvrtx.html