![libnlopt.so.0 无法打开共享对象文件](https://linux22.com/image/164355/libnlopt.so.0%20%E6%97%A0%E6%B3%95%E6%89%93%E5%BC%80%E5%85%B1%E4%BA%AB%E5%AF%B9%E8%B1%A1%E6%96%87%E4%BB%B6.png)
这个错误是什么意思?
ImportError: libnlopt.so.0: cannot open shared object file: No such file or directory
我尝试运行 python2脚本这需要nlopt。
nlopt 安装者为
pip2 install --user nlopt
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting nlopt
Using cached https://files.pythonhosted.org/packages/7f/4f/de7e64a295e86c9f1ee382076019e0526247969353eb29345da1a05854b6/nlopt-2.4.2.post2.tar.gz
Requirement already satisfied: numpy in /usr/lib/python2.7/dist-packages (from nlopt) (1.13.3)
Installing collected packages: nlopt
Running setup.py install for nlopt ... done
Successfully installed nlopt-2.4.2.post2
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
答案1
这意味着无法加载共享库。您可以通过执行以下操作来解决问题:
sudo apt-get install libnlopt0
然后运行你的命令。
也就是说,如果您运行的是 Debian/Ubuntu 或衍生版本。如果没有,请使用您的发行版用来添加包的任何命令,在本例中为libnlopt0
。