运行pip install py3exiv2
时出现此错误:
Collecting py3exiv2
Downloading py3exiv2-0.2.1.tar.gz
Installing collected packages: py3exiv2
Running setup.py install for py3exiv2 ... error
Complete output from command /home/vagrant/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-j6a3aby9/py3exiv2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ppz_a46j-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/vagrant/venv/include/site/python3.4/py3exiv2:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/pyexiv2
copying src/pyexiv2/iptc.py -> build/lib.linux-x86_64-3.4/pyexiv2
copying src/pyexiv2/exif.py -> build/lib.linux-x86_64-3.4/pyexiv2
copying src/pyexiv2/xmp.py -> build/lib.linux-x86_64-3.4/pyexiv2
copying src/pyexiv2/preview.py -> build/lib.linux-x86_64-3.4/pyexiv2
copying src/pyexiv2/__init__.py -> build/lib.linux-x86_64-3.4/pyexiv2
copying src/pyexiv2/utils.py -> build/lib.linux-x86_64-3.4/pyexiv2
copying src/pyexiv2/metadata.py -> build/lib.linux-x86_64-3.4/pyexiv2
running build_ext
building 'libexiv2python' extension
creating build/temp.linux-x86_64-3.4
creating build/temp.linux-x86_64-3.4/src
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/home/vagrant/venv/include -I/usr/include/python3.4m -c src/exiv2wrapper.cpp -o build/temp.linux-x86_64-3.4/src/exiv2wrapper.o -g
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from src/exiv2wrapper.cpp:27:0:
src/exiv2wrapper.hpp:32:27: fatal error: exiv2/image.hpp: No such file or directory
#include "exiv2/image.hpp"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
我尝试使用Python 3.5的Mac,以及使用virtualenv和Python 3.4的Ubuntu,类似的错误。
我忘了手动安装一些依赖项吗? 该软件包是否未使用最新的Python版本进行维护?
感谢。
答案 0 :(得分:5)
尝试
sudo apt-get install build-essential
sudo apt-get install python-all-dev
sudo apt-get install libexiv2-dev
sudo apt-get install libboost-python-dev
然后
pip3 install py3exiv2
应该没问题......那些是py3exiv2的构建依赖...
答案 1 :(得分:1)
Pawel,问我如何在AWS EC2 Linux2发行版的centOS上构建py3exiv2。 我从“ Team Exiv”团队获得了很多帮助,一些会员也在“ openhub.com”上找到了。 我已经附上了我开发的原始操作手册。您显然需要选择更新的库。
请记住,这里有粗略的注释,而不是详细且高度修饰的手册。另外,我至少有12个月没有对其进行测试。考虑一下这些步骤在做什么,如果不起作用,请对照库doco检查语法。
这是基于VirtualBox环境构建的,该环境仅与VM设置有关
如果我的回忆是正确的,早期的测试是在Centos 7.4上进行的(?CentOS-7-x86_64-DVD-1708.iso?)。除了在Linux2用户数据和元数据方面,Centos构建与AWS Linux2发行版构建基本相同。
Need to set user-data & meta-data to prep the Linux2 distro. (see AWS doco)
VirtualBox nic to Bridge and active nic
storage to use new seed.iso
update /etc/ssh/sshd_config
PermitRootLogin yes
and
PasswordAuthentication yes
#PasswordAuthentication no
Check disk space needed !! need about 4GB
Add & mount another vol if needed
~~~~~~~~~~~~~
If using Virtual Box you can set up folder / directory sharing as follows
https://www.if-not-true-then-false.com/2010/install-virtualbox-guest-additions-on-fedora-centos-red-hat-rhel/
For AWS Linux2 (Q1 2018) It found that the CentOS7 process worked perfectly. (watch the wrong form quote marks)
https://gist.github.com/larsar/1687725
~~~~~~~~~~~~~
http://dev.exiv2.org/projects/exiv2/wiki/How_do_I_build_Exiv2_on_the_XYZ_platform
write to log as well as screen
some_command | tee log.txt
| tee ~/mk4b-#.log
1) Install Development Tools on CentOS
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)
sudo yum -y update
sudo yum -y install yum-utils
sudo yum -y groupinstall development
2) Build and test exiv2
2.a) Install dependent libraries:
sudo yum -y install expat-devel
sudo yum -y install zlib-devel
sudo yum -y install openssl-devel
2.b) Install tools required for the Exiv2 test suite
sudo yum -y install subversion
sudo yum -y install dos2unix
2.c) Get the code
http://www.exiv2.org/download.html
2.d) Install the code into the build tree
mkdir -p ~/gnu/exiv2
cd ~/gnu/exiv2
~~~~~~~~~~~~~~~~~
curl -O http://www.exiv2.org/builds/exiv2-0.26-trunk.tar.gz
tar xzf exiv2-0.26-trunk.tar.gz
cd exiv2-trunk/
~~~~~~~~~~~~~~~
2.e) Build it
(http://dev.exiv2.org/projects/exiv2/wiki/How_do_I_build_Exiv2_on_the_XYZ_platform)
cd ~/gnu/exiv2/exiv2-trunk
./configure | tee ~/mk7-2e1.log
make | tee ~/mk7-2e2.log
sudo make install | tee ~/mk7-2e3.log
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/lib/pkgconfig"
2.f) Run the test suite (optional)
svn export svn://dev.exiv2.org/svn/tags/0.26/test
# you only need to do this once to download the test suite
make samples | tee ~/mk7-2f1.log
make tests | tee ~/mk7-2f2.log
3) Build and install python 3.6.4
3.a) Get the code
https://www.python.org/downloads/
mkdir ~/gnu/python3
cd ~/gnu/python3
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
3.b)
tar xzf Python-3.6.4.tgz
pwd
ls -la
3.c) Built and install python3.6.4
cd ~/gnu/python3/Python-3.6.4
./configure ## ./configure | tee ~/mk7-3c1.log
make #### make | tee ~/mk7-3c2.log
sudo make install ## sudo make install | tee ~/mk7-3c3.log
3.d) Create a link to use python3
which python3
which python3.6
sudo ln -s /usr/local/bin/python3.6 /usr/local/bin/python3
4) Build and install boost
4.a) Get the code from http://www.boost.org/users/download/ (wget)
mkdir ~/gnu/boost
cd ~/gnu/boost
wget https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz
4.b) extract boost
tar xzf boost_1_66_0.tar.gz
cd ~/gnu/boost/boost_1_66_0
ls -la
4.c)Build and install boost
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 **** check which python 3.6
## ./bootstrap.sh --with-python=/usr/local/bin/python3.6 | tee ~/mk7-4c1.log
./b2 ## ./b2 | tee ~/mk7-4c2.log
sudo $PWD/b2 install ## sudo $PWD/b2 install | tee ~/mk7-4c3.log
5) Build and test py3exiv2
5.a) Get the code from https://pypi.python.org/pypi/py3exiv2/0.1.0
mkdir ~/gnu/py3exiv2
cd ~/gnu/py3exiv2
… copy the source into ~/gnu/py3exiv2/py3exiv2-0.1.0
wget https://pypi.python.org/packages/60/3b/087a0852d41c5e23eda386f9569c8a2d21085421fe623f9fc9ad14e5a0eb/py3exiv2-0.1.0.tar.gz#md5=cbbc08a30dccedea1fef4f3dd4637db1
tar xzf py3exiv2-0.1.0.tar.gz
ls -la
5.b) Build and install py3exiv2
cd ~/gnu/py3exiv2/py3exiv2-0.1.0
ls -la
sudo /usr/local/bin/python3.6 setup.py install
## sudo /usr/local/bin/python3.6 setup.py install | tee ~/mk7-5b1.log
~~~~~~~~~~~~~~~~
5.c) Test py3exiv2
python3.6
import pyexiv2
image=pyexiv2.ImageMetadata('/home/vict/gnu/exiv2/exiv2-trunk/test/data/exiv2-bug876.jpg') # image on your computer
image.read()
image.exif_keys
'/home/vict/gnu/exiv2/exiv2-trunk/test/data/exiv2-bug876.jpg'
/home/vict/gnu/exiv2/exiv2-trunk/test/data/preview/eps-nested_xmp_ai-8-lev3-preview1.tif
/home/vict/gnu/boost/boost_1_66_0/tools/build/doc/images/warning.png
……….. lots and lots of lovely output …………….
6) To run in a “clean shell”
6.a) Set LD_LIBRARY_PATH
consider setting this in your ~/.login or ~/.bashrc or ~/.profile so that it’s “always set"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
6.b) Run python3
python3
import pyexiv2
help(pyexiv2)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./b2
===
gcc.compile.c++ bin.v2/libs/wave/build/gcc-gnu-4.8.5/release/link-static/threadapi-pthread/threading-multi/cpplexer/re2clex/cpp_re.o
gcc.archive bin.v2/libs/wave/build/gcc-gnu-4.8.5/release/link-static/threadapi-pthread/threading-multi/libboost_wave.a
common.copy stage/lib/libboost_wave.a
...failed updating 54 targets...
...skipped 6 targets...
...updated 1160 targets...
[vict@localhost boost_1_66_0]$
[vict@localhost boost_1_66_0]$ ls -la
total 724
~~~~~~~~~~~~~~~~~~~~~~~~
redo to include OpenSSL - sqlite3
3.c) Built and install python3.6.4
cd ~/gnu/python3/Python-3.6.4
./configure ## ./configure | tee ~/mk7-3c1-c.log
make #### make | tee ~/mk7-3c2-c.log
sudo make install ## sudo make install | tee ~/mk7-3c3-c.log
3.d) Create a link to use python3
which python3
which python3.6
sudo ln -s /usr/local/bin/python3.6 /usr/local/bin/python3
\\
答案 2 :(得分:0)
是的,这是一个挑战。 我能够在centOS和AWS EC2 Linux2发行版上“构建”py3exiv2。但是我还没有成功使用MacOS,但是发现使用共享驱动器安装的VirtualBox非常有效。
如果您对运行表有兴趣进行构建,请告诉我,我会将其清理并在此处发布。
[R