这个错误是什么意思?
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
。