Python program decompression RAR compression packet error

Source: Internet
Author: User

Run the following Python program error couldn ' t find path to Unrar Library solution:

#!/usr/bin/python#-*-coding:utf-8-*-from unrar Import rarfilefile = Rarfile. Rarfile ('/root/ssl.rar ') file.extractall ('/tmp ')

Note: Rarfile has been installed through PIP3 install Rarfile, but unrar with PIP3 although the prompt is successful but there is a problem, so manually installed under the Unrar package.




1. Install dependent packages

Yum Install gcc gcc-c++



2, download Unrar package, install, compile

wget Http://www.rarlab.com/rar/unrarsrc-5.4.5.tar.gztar zxf unrarsrc-5.4.5.tar.gzcd Unrar


Using the Make Lib command will automatically compile the library file and use the Make Install-lib command to generate the libunrar.so file (typically below the/usr/lib directory)

Make Libmake Install-lib




3. At the end of the/etc/profile file, add

Vi/etc/profileexport unrar_lib_path=/usr/lib/libunrar.so successfully saved and then use the command to make the variable effective source/etc/profile


Python program decompression RAR compression packet error

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.