Project

General

Profile

BuildingPy3Exiv2onCentos » History » Revision 2

Revision 1 (Robin Mills, 22 Feb 2018 16:33) → Revision 2/7 (Robin Mills, 22 Feb 2018 16:46)

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

(https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-centos-7)
sudo
yum -y update
sudo yum -y install yum-utils
sudo yum -y groupinstall development</pre> development

h2. 2) Build and test exiv2

h3. 2.a) Install dependent libraries:

<pre>sudo

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

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

<pre>sudo

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

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

~/gnu/exiv2
… 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

(http://dev.exiv2.org/projects/exiv2/wiki/How_do_I_build_Exiv2_on_the_XYZ_platform)
cd
~/gnu/exiv2/exiv2-trunk
./configure
make
sudo make install</pre> install
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/lib/pkgconfig”


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

<pre>export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/lib/pkgconfig”

svn export svn://dev.exiv2.org/svn/tags/0.26/test # you only need to do this once only to download the test suite
make samples
make tests</pre> tests

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>


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

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

<pre>cd

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

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

<pre>sudo

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

h2. 4) Build and install boost

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

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


mkdir ~/gnu/boost
… copy the source into ~/gnu/boost/boost_1_66_0

h3. 4.b) Build and install boost

<pre>cd

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> install

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>


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

h3. 5.b) Build and install py3exiv2

<pre>cd

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

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(‘/home/username/Pictures/MyImage.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”

h3. 6.a) Set LD_LIBRARY_PATH


I recommend you set this in your ~/.login or ~/.bashrc or ~/.profile so that it’s “always set"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib”


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

h3.
6.b) Run python3

<pre>python3

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