在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
就好了,报错解决。
网友评论