Package-Management

libnlopt.so.0 無法打開共享對象文件

  • November 20, 2019

這個錯誤是什麼意思?

ImportError: libnlopt.so.0: cannot open shared object file: No such file or directory

我試圖執行需要 nlopt的 python2腳本。

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.

這意味著無法載入共享庫。您可以通過以下方式解決問題:

sudo apt-get install libnlopt0

然後執行你的命令。

也就是說,如果您正在執行 Debian/Ubuntu 或衍生產品。如果沒有,請使用您的發行版用來添加包的任何命令,在這種情況下為libnlopt0.

引用自:https://unix.stackexchange.com/questions/553239