Check if library installed linux

How to check if a shared library is installed?

My question originates from my problem in getting ffmpeg started. I have installed ffmpeg and it is displayed as installed:

whereis ffmpeg ffmpeg: /usr/bin/ffmpeg /usr/bin/X11/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz 

Later, I figured out, that some programs depend on libraries that do not come with the installation itself, so I checked with ldd command what is missing:

# ldd /usr/bin/ffmpeg linux-vdso.so.1 => (0x00007fff71fe9000) libavfilter.so.0 => not found libpostproc.so.51 => not found libswscale.so.0 => not found libavdevice.so.52 => not found libavformat.so.52 => not found libavcodec.so.52 => not found libavutil.so.49 => not found libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5f20bdf000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f5f209c0000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5f205fb000) /lib64/ld-linux-x86-64.so.2 (0x00007f5f20f09000) 

As it turns out my ffmpeg is cut off from 7 libraries too work. I first thought that each of those libraries have to be installed, but than I figured out, that some or all might be installed, but their location unknown to ffmpeg. I read that /etc/ld.so.conf and /etc/ld.so.cache contain the paths to the libraries, but I was confused, because, there was only one line in

/etc/ld.so.conf cat /etc/ld.so.conf include /etc/ld.so.conf.d/*.conf 

but a very long /etc/ld.so.cache . I am now at a point where I feel lost how to investigate further, It might be a helpful next step to figure out, how I can determine if a given library is indeed installed even if its location unknown to ffmpeg.

---------Output---of----apt-cache-policy-----request--------- apt-cache policy Package files: 100 /var/lib/dpkg/status release a=now 500 http://archive.canonical.com/ubuntu/ trusty/partner Translation-en 500 http://archive.canonical.com/ubuntu/ trusty/partner i386 Packages release v=14.04,o=Canonical,a=trusty,n=trusty,l=Partner archive,c=partner origin archive.canonical.com 500 http://archive.canonical.com/ubuntu/ trusty/partner amd64 Packages release v=14.04,o=Canonical,a=trusty,n=trusty,l=Partner archive,c=partner origin archive.canonical.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe Translation-en 500 http://security.ubuntu.com/ubuntu/ trusty-security/restricted Translation-en 500 http://security.ubuntu.com/ubuntu/ trusty-security/multiverse Translation-en 500 http://security.ubuntu.com/ubuntu/ trusty-security/main Translation-en 500 http://security.ubuntu.com/ubuntu/ trusty-security/multiverse i386 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=multiverse origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe i386 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=universe origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/restricted i386 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=restricted origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/main i386 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=main origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/multiverse amd64 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=multiverse origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/universe amd64 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=universe origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/restricted amd64 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=restricted origin security.ubuntu.com 500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages release v=14.04,o=Ubuntu,a=trusty-security,n=trusty,l=Ubuntu,c=main origin security.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/restricted Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/multiverse Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/multiverse i386 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=multiverse origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe i386 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=universe origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/restricted i386 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=restricted origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main i386 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=main origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/multiverse amd64 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=multiverse origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=universe origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/restricted amd64 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=restricted origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages release v=14.04,o=Ubuntu,a=trusty-updates,n=trusty,l=Ubuntu,c=main origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/universe Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty/restricted Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty/multiverse Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty/main Translation-en 500 http://archive.ubuntu.com/ubuntu/ trusty/multiverse i386 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=multiverse origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/universe i386 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=universe origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/restricted i386 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=restricted origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/main i386 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=main origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/multiverse amd64 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=multiverse origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=universe origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/restricted amd64 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=restricted origin archive.ubuntu.com 500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages release v=14.04,o=Ubuntu,a=trusty,n=trusty,l=Ubuntu,c=main origin archive.ubuntu.com 700 http://extra.linuxmint.com/ rebecca/main i386 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main origin extra.linuxmint.com 700 http://extra.linuxmint.com/ rebecca/main amd64 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main origin extra.linuxmint.com 700 http://packages.linuxmint.com/ rebecca/import i386 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=import origin packages.linuxmint.com 700 http://packages.linuxmint.com/ rebecca/upstream i386 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=upstream origin packages.linuxmint.com 700 http://packages.linuxmint.com/ rebecca/main i386 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main origin packages.linuxmint.com 700 http://packages.linuxmint.com/ rebecca/import amd64 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=import origin packages.linuxmint.com 700 http://packages.linuxmint.com/ rebecca/upstream amd64 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=upstream origin packages.linuxmint.com 700 http://packages.linuxmint.com/ rebecca/main amd64 Packages release v=17.1,o=linuxmint,a=rebecca,n=rebecca,l=linuxmint,c=main origin packages.linuxmint.com Pinned packages: 

Источник

Читайте также:  Md5 хэш файла linux

How do I check whether a module is installed in Python, and install it if needed?

Warning: It is highly recommended to install python-modules using official Ubuntu repository only and not to use the pip method as superuser(i.e., as root or using sudo ). In some cases it may leave your system unusable by breaking system python.

Like in your answer math module exists and for numby the traceback didnt appear and for echo $? output was 0, Does it mean numpy is also present in my system?

In case you don’t have the module numpy how will you import it? When we do the coding we call the import statement by from numpy import *, will it install the module ? If not how will we install a new module?

It will be a septate question how to install a module. Need different packages for different module. For example to install vpython you need to install it as sudo apt-get install python-visual libgtkglextmm-x11-1.2-dev

don’t use sudo pip ; it may break system python. Use apt-get to install packages for system python. You could use pip —user option or virtualenv to install Python packages for yourself.

In case we do not want to unwantedly import a module in question (which would happen in a try statement) we can make use of sys.modules to test modules that are installed and were imported before.

In the python shell issue:

Then test for installed modules:

>>> 'numpy' in sys.modules True >>> 'scipy' in sys.modules False 

Note that only those modules that were imported before give True on this test, all other modules (even if installed) result in False.

Читайте также:  Unable to boot linux

Another alternative to try an import statement in the python console is calling the inbuilt help() function. This will not give a documentation for non-installed modules, e.g.

>>> help('scipy') no Python documentation found for 'scipy' 

The output of very long help documents of installed modules can be interrupted with Q .

Now to install missing modules it is recommended to use the Ubuntu package management (and not the Python pip way) because we need root access and also to prevent messing up our heavily Python-dependend system. For the module in question this would e.g. be:

sudo apt-get install python-scipy ## for Python2 sudo apt-get install python3-scipy ## for Python3 

After installation we then can add them to the sys.modules dictionary by importing them once.

Источник

Оцените статью
Adblock
detector