Introduce Python library TRML2PDF to MacOSX (10.11.xx)

Note that I stumbled a little with the introduction of TRML2PDF, a library that generates PDF with Python.

environment: MacOSX(10.11.6 El Capitane) Python2.7.x (pyenv environment for convenience)

Introduced pip and homebrew

What I did in the end

#Library that handles jpeg
brew install jpeg

#Python image processing library
pip install pillow

#Python PDF generation library
pip install trml2pdf

Is OK.

Install TRML2PDF

See below. TRML2PDF https://github.com/romanlv/trml2pdf/

As written in the README

pip install trml2pdf

If so

ValueError: jpeg is required unless explicitly disabled using --disable-jpeg, aborting

It has become. Explicitly add an option to disable jpeg. If you read a little more, you need a library called Pillow to use TRML2PDF, so you're getting an error while installing it.

Pillow installation

pip install pillow
...
ValueError: jpeg is required unless explicitly disabled using --disable-jpeg, aborting

I'm getting the same error as a matter of course because I'm getting an error while installing Pillow. Anyway, I found that the cause was that the Pillow installation failed.

According to the investigation, when trying to handle jpeg with Pillow, a library called libjpeg that encodes and decodes jpeg is required. How. https://ja.wikipedia.org/wiki/Libjpeg

Install libjepg with homebrew

brew install jpeg

Install Pillow with pip again

pip install pillow

Install TRML2PDF with pip again

pip install trml2pdf

It's fine from the interpreter, so let's import it.

python

Python 2.7.2 (default, Nov 25 2016, 09:30:37) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> import trml2pdf
>>>

Looks good!

Recommended Posts

Introduce Python library TRML2PDF to MacOSX (10.11.xx)
Introduction to Python Numerical Library NumPy
[Python] How to import the library
[Python] Introduce UIKit3 to your Django project
Python 3.6 email library
How to use the C library in Python
Updated to Python 2.7.9
Library comparison summary to generate PDF with Python
Python ast library
How to use Python Image Library in python3 series
Python Library notes
[AWS / Lambda] How to load Python external library
"Backport" to python 2
When I tried to introduce python3 to atom, I got stuck
Introduce pipe operators and function synthesis to Python (provisional)
I wanted to use the Python library from MATLAB
[Python] How to use the graph creation library Altair
[Python] A convenient library that converts kanji to hiragana
I made a python library to do rolling rank
[Introduction to Python] Basic usage of the library matplotlib
Publish / upload a library created in Python to PyPI
How to install Python
Changes from Python 3.0 to Python 3.5
python algorithmic trading library
Changes from Python 2 to Python 3.0
Introduce serverspec to Linux
Rewrite Python2 code to Python3 (2to3)
How to install python
Introduction to Python language
Introduction to OpenCV (python)-(2)
Install python external library
Python optimization library Pulp
Introducing Python 2.7 to CentOS 6.6
Connect python to mysql
[Python MinMaxScaler] Normalize to 0 ~ 1
Introduce elpy to emacs
How to debug the Python standard library in Visual Studio
How to import Python library set up in EFS to Lambda
[python] How to use the library Matplotlib for drawing graphs
[AWS] Try adding Python library to Layer with SAM + Lambda (Python)
Developed a library to get Kindle collection list in Python
I published my own Python baseball library to Packaging & PyPI
Convert images to sepia toning with PIL (Python Imaging Library)
Pass OpenCV data from the original C ++ library to Python