RuntimeError: Unable to locate turbojpeg library automatically. You may specify the turbojpeg librar

This error occurs when using the official instance code of jpegturbo. Record the solution.

Environment introduction

          ubuntu 16.04

          conda

          python3.7

Error details

Traceback (most recent call last):
  File "/home/ubuntu/PycharmProjects/python_code_test/JPEGTurbo/official_demo1.py", line 30, in <module>
    turbo_jpeg = TurboJPEG()
  File "/home/ubuntu/.conda/envs/pytorch-1.7/lib/python3.7/site-packages/turbojpeg.py", line 286, in __init__
    self.__find_turbojpeg() if lib_path is None else lib_path)
  File "/home/ubuntu/.conda/envs/pytorch-1.7/lib/python3.7/site-packages/turbojpeg.py", line 895, in __find_turbojpeg
    'Unable to locate turbojpeg library automatically. '
RuntimeError: Unable to locate turbojpeg library automatically. You may specify the turbojpeg library path manually.
e.g. jpeg = TurboJPEG(lib_path)

Solution

sudo apt-get update -y
sudo apt-get install -y libturbojpeg

References

PyTurboJPEG · PyPI

https://github.com/lilohuang/PyTurboJPEG/issues/27

Read More: