Project

General

Profile

BuildingPy3Exiv2onCentos » History » Revision 4

Revision 3 (Robin Mills, 22 Feb 2018 19:29) → Revision 4/7 (Robin Mills, 22 Feb 2018 19:31)

h1. Building Exiv2 v0.26 + Python 3.6.4 + Py3Exiv2 v0.1.0 on Centos

h2. 1) Install Development Tools on CentOS

h3. 1.a) Update the system and install the development tools

https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-centos-7

<pre>sudo yum -y update
sudo yum -y install yum-utils
sudo yum -y groupinstall development</pre>

h2. 2) Build and test exiv2

h3. 2.a) Install dependent libraries:

<pre>sudo yum -y install expat-devel
sudo yum -y install zlib-devel</pre>

h3. 2.b) Install tools required for the Exiv2 test suite

<pre>sudo yum -y install subversion
sudo yum -y install dos2unix
sudo yum -y install curl</pre>

h3. 2.c) Get the code

http://www.exiv2.org/download.html

h3. 2.d) Install the code into the build tree

<pre>mkdir -p ~/gnu/exiv2</pre>



copy the source into ~/gnu/exiv2/exiv2-trunk

h3. 2.e) Build it

http://dev.exiv2.org/projects/exiv2/wiki/How_do_I_build_Exiv2_on_the_XYZ_platform

<pre>cd ~/gnu/exiv2/exiv2-trunk
./configure
make
sudo make install</pre>

h3. 2.f) Run the test suite (optional)

<pre>export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/lib/pkgconfig PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/lib/pkgconfig”
svn export svn://dev.exiv2.org/svn/tags/0.26/test # once only
make samples
make tests</pre>

h2. 3) Build and install python 3.6.4

h3. 3.a) Get the code

https://www.python.org/downloads/

h3. 3.b) Install the code into the build tree

<pre>mkdir ~/gnu/python</pre>



copy the source into ~/gnu/python/Python-3.6.4

h3. 3.c) Built and install python3.6.4

<pre>cd ~/gnu/python/Python-3.6.4
./configure
make
sudo make install</pre>

h3. 3.d) Create a link to use python3

<pre>sudo ln -s /usr/local/bin/python3.6 /usr/local/bin/python3</pre>

h2. 4) Build and install boost

h3. 4.a) Get the code from http://www.boost.org/users/download/

<pre>mkdir ~/gnu/boost</pre>



copy the source into ~/gnu/boost/boost_1_66_0

h3. 4.b) Build and install boost

<pre>cd ~/gnu/boost/boost_1_66_0

export BOOST_LIBRARYDIR=$PWD/libs
export BOOST_ROOT=$PWD
export CPLUS_INCLUDE_PATH=/usr/local/include/python3.6m
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
./bootstrap.sh --with-python=/usr/local/bin/python3.6
./b2
sudo $PWD/b2 install</pre>

h2. 5) Build and test py3exiv2

h3. 5.a) Get the code from https://pypi.python.org/pypi/py3exiv2/0.1.0

<pre>mkdir ~/gnu/py3exiv2</pre>



copy the source into ~/gnu/py3exiv2/py3exiv2-0.1.0

h3. 5.b) Build and install py3exiv2

<pre>cd ~/gnu/py3exiv2/py3exiv2-0.1.0
sudo /usr/local/bin/python3.6 setup.py install</pre>

h3. 5.c) Test py3exiv2

<pre>curl -O http://clanmills.com/Stonehenge.jpg
python3.6
import pyexiv2
image=pyexiv2.ImageMetadata(Stonehenge.jpg) image=pyexiv2.ImageMetadata(‘Stonehenge.jpg’) # image on your computer
image.read()
image.exif_keys
.. ……….. lots and lots of lovely output . …………….
</pre>

h2. 6) To run in a _clean shell_ _“clean shell”_

h3. 6.a) Set LD_LIBRARY_PATH

I recommend you set this in @~/.login@ or @~/.bashrc@ or @~/.profile@ so that its *"always set"*__ it’s “always set"

<pre>export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib</pre> LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib”</pre>

h3. 6.b) Run python3

<pre>python3
import pyexiv2
help(pyexiv2)</pre>