ubantu 安装swig报错 swig: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
先安装swig3.0
参考这个帖子进行安装,注意安装路径下面会用到这个路径
https://blog.csdn.net/wohu1104/article/details/122458426
安装 pere-8.30
-rw-rw-r-- 1 ubantu ubantu 403 12月 11 14:45 xsltConf.sh
ubantu@ubantu-virtual-machine:~/anaconda3/lib$ find | grep libpcre
./libpcrecpp.a
./libpcreposix.so
./libpcre.so
./libpcreposix.a
./libpcre.a
./libpcrecpp.la
./libpcreposix.so.0
./pkgconfig/libpcreposix.pc
./pkgconfig/libpcre.pc
./pkgconfig/libpcrecpp.pc
./libpcre.so.1.2.10
./libpcre.la
./libpcreposix.la
./libpcrecpp.so
./libpcreposix.so.0.0.6
./libpcrecpp.so.0
./libpcre.so.1
./libpcrecpp.so.0.0.1
ubantu@ubantu-virtual-machine:~/anaconda3/lib$ pwd
/home/ubantu/anaconda3/lib
ubantu@ubantu-virtual-machine:~/anaconda3/lib$ cd ~/usr/swig/usr/local/bin
bash: cd: /home/ubantu/usr/swig/usr/local/bin: 没有那个文件或目录
之后进入下载好 pcre 和 swig 的linux版本文件路径,如下:
ubantu@ubantu-virtual-machine:~/下载$ ll
总用量 9468
drwxr-xr-x 4 ubantu ubantu 4096 12月 11 16:02 ./
drwxr-xr-x 20 ubantu ubantu 4096 12月 11 17:02 ../
drwxr-xr-x 8 ubantu ubantu 12288 12月 11 16:07 pcre-8.30/
-rw-rw-r-- 1 ubantu ubantu 1635262 12月 11 16:01 pcre-8.30.tar.gz
drwxrwxr-x 10 ubantu ubantu 4096 12月 11 15:37 swig-3.0.10/
-rw-rw-r-- 1 ubantu ubantu 8029827 12月 11 15:15 swig-3.0.10.tar.gz
# 进入到对应文件夹目录
ubantu@ubantu-virtual-machine:~/下载$ cd pcre-8.30/.libs/
ubantu@ubantu-virtual-machine:~/下载/pcre-8.30/.libs$
ubantu@ubantu-virtual-machine:~/下载/pcre-8.30/.libs$
ubantu@ubantu-virtual-machine:~/下载/pcre-8.30/.libs$
ubantu@ubantu-virtual-machine:~/下载/pcre-8.30/.libs$
# move 需要实现安装好swig3.0版本,自行查阅资料
ubantu@ubantu-virtual-machine:~/下载/pcre-8.30/.libs$ sudo mv -v libpcre.so.* /usr/lib/
[sudo] password for ubantu:
"libpcre.so.1" -> "/usr/lib/libpcre.so.1"
"libpcre.so.1.0.0" -> "/usr/lib/libpcre.so.1.0.0"
ubantu@ubantu-virtual-machine:~/下载/pcre-8.30/.libs$
ubantu@ubantu-virtual-machine:~/下载/pcre-8.30/.libs$
ubantu@ubantu-virtual-machine:~/下载/pcre-8.30/.libs$
ubantu@ubantu-virtual-machine:~/下载/pcre-8.30/.libs$
ubantu@ubantu-virtual-machine:~/下载/pcre-8.30/.libs$
# 查看版本信息
ubantu@ubantu-virtual-machine:~/下载/pcre-8.30/.libs$ swig -version
SWIG Version 3.0.10
Compiled with g++ [x86_64-pc-linux-gnu]
Configured options: +pcre
Please see http://www.swig.org for reporting bugs and further information
ubantu@ubantu-virtual-machine:~/下载/pcre-8.30/.libs$
参考资料:
https://unix.stackexchange.com/questions/421257/swig-error-in-ubuntu-16-04