Python RarFile unpack RAR package Error Rarfile.RarCannotExec: Cannot find Working Tool

recently encountered an error using python to unzip rar.
installation is the rarfile package, but the implementation of decompression error, the Internet to find a lot of methods have not solved.

import rarfile
path1 = "E://test.rar"
with rarfile.RarFile(path1) as rf:
    rf.extractall()

currently the main online solutions are as follows:
1. Put winrar. Exe under python project venv – scripts. 2. Install unrar on Windows and configure environment variables.

I tried the first method and found that it did not solve the problem, and I did not try the second method because I could not find a suitable installation package.

considering that winrar program is installed on the machine, so inspired by the second method, configure winrar path in the system environment variable, and then restarts pycharm, and the problem is found to be perfectly solved.


Read More: