[PYTHON] Comment installer OpenGM sur OSX avec macports

Préparation

Installation du package


sudo port install python27 py27-scipy py27-numpy py27-networkx py27-h5py py27-matplotlib py27-nose nosetests_select
sudo port install boost +python27
sudo port install doxygen graphviz py27-pygraphviz

Cloner avec git


git clone https://github.com/opengm/opengm.git
cd opengm/
mkdir build
cd build
cmake ..

Construire

Ajouter une bibliothèque externe


make -k externalLibs

Je ne pleure pas même si je reçois une erreur et que je m'arrête. .. .. Seule la bibliothèque externe qui peut être compilée est ajoutée à ../CMakeFile.

--Dans ce qui suit, AD3, TRWS, MRF, QPBO, MAXFLOW, PLANARITY, BLOSSOM5 sont ajoutés en tant que bibliothèques externes.

diff:../Modification de CMakeFile (exemple). Ajout d'une bibliothèque externe, Boost, etc.


diff --git a/CMakeLists.txt b/CMakeLists.txt
index d5fb1a9..d58c167 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,30 +67,30 @@ endif()
 OPTION(BUILD_EXAMPLES "Build Examples" ON)
 OPTION(BUILD_TUTORIALS "Build Tutorials" ON)
 OPTION(BUILD_COMMANDLINE "Build Commandline" OFF)
-OPTION(WITH_AD3 "Include AD3" OFF)
+OPTION(WITH_AD3 "Include AD3" ON)
 OPTION(WITH_CPLEX "Include CPLEX" OFF)
 OPTION(WITH_GUROBI "Include GUROBI" OFF)
-OPTION(WITH_BOOST "Include BOOST" OFF)
-OPTION(WITH_HDF5 "Include HDF5" OFF)
-OPTION(WITH_TRWS "Include wrapper for TRWS code" OFF)
+OPTION(WITH_BOOST "Include BOOST" ON)
+OPTION(WITH_HDF5 "Include HDF5" ON)
+OPTION(WITH_TRWS "Include wrapper for TRWS code" ON)
 OPTION(WITH_GCO "Include wrapper for GCO code" OFF)
-OPTION(WITH_MRF "Include wrapper for MRF code" OFF)
-OPTION(WITH_QPBO "Include wrapper for QPBO code" OFF)
+OPTION(WITH_MRF "Include wrapper for MRF code" ON)
+OPTION(WITH_QPBO "Include wrapper for QPBO code" ON)
 OPTION(WITH_FASTPD "Include wrapper for FastPD code" OFF)
-OPTION(WITH_MAXFLOW "Include wrapper for MAXFLOW code" OFF)
+OPTION(WITH_MAXFLOW "Include wrapper for MAXFLOW code" ON)
 OPTION(WITH_MAXFLOW_IBFS "Include wrapper for MAXFLOW-IBFScode" OFF)
 OPTION(WITH_LIBDAI "Include wrapper for LIBDAI code" OFF)
 OPTION(WITH_DAOOPT "Include wrapper for DAOOPT code" OFF)
 OPTION(WITH_MPLP "Include wrapper for MPLP code" OFF)
 OPTION(WITH_SRMP "Include wrapper for SRMP code" OFF)
-OPTION(WITH_PLANARITY "Include wrapper for PLANARITY code" OFF)
-OPTION(WITH_BLOSSOM5 "Include wrapper for BLOSSOM5 code" OFF)
+OPTION(WITH_PLANARITY "Include wrapper for PLANARITY code" ON)
+OPTION(WITH_BLOSSOM5 "Include wrapper for BLOSSOM5 code" ON)
 OPTION(WITH_OPENMP "Include OpenMP" OFF)
 OPTION(WITH_VIGRA "Include VIGRA" OFF)
 OPTION(WITH_CONICBUNDLE "Include ConicBundleLibrary" OFF)
 OPTION(WITH_MATLAB "Activate MatLab-Code" OFF)
 OPTION(BUILD_CONVERTER "Build several converters" OFF)
-OPTION(BUILD_PYTHON_WRAPPER "Build python wrapper" OFF)
+OPTION(BUILD_PYTHON_WRAPPER "Build python wrapper" ON)
 OPTION(BUILD_MATLAB_WRAPPER "Build matlab wrapper" OFF)
 ###Grante needs C++11. Since we have not tested OpenGM under this standard yet, using Grante is realy experimental!!!
 ###OPTION(WITH_GRANTE "Include wrapper for grante" OFF)

Dans ce qui suit, définissez l'option cmake afin de ne pas accéder au système / usr / bin / python (en utilisant macports python2.7).

CMake à nouveau


rm CMakeCache.txt
cmake ..  \
  -DPYTHON_EXECUTABLE:FILEPATH=/opt/local/bin/python2.7 \
  -DPYTHON_INCLUDE_DIR:PATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Headers/ \
  -DPYTHON_LIBRARY:FILEPATH=/opt/local/lib/libpython2.7.dylib 

Et construire


make -j 4

création de documents


make doc

tester

Et tester


make test

Running tests...
...
100% tests passed, 0 tests failed out of 60

Total Test time (real) =  45.89 sec

Tester la liaison python


make test-python-wrapper

...
Ran 70 tests in 3.584s

OK
[100%] Built target test-python-wrapper

Si make test-python-wrapper indique qu'il n'y a pas de nosetests

nosetests à nosetests-2.Lien vers 7


sudo port select --set nosetests nosetests27

Installation

Si vous installez localement


make DESTDIR=$HOME/local install

mkdir $HOME/local/usr/local/lib
cp ../build/src/external/libexternal-library-* $HOME/local/usr/local/lib

avec ça

Au fait, si vous n'utilisez pas de bibliothèque externe ou de python, OpenGM n'est qu'un fichier d'en-tête.

Paramètres: utiliser la liaison python

~/.bash_Ajouter au profil


# opengm                                                                                                                                       
export LD_LIBRARY_PATH=$HOME/local/usr/local/lib/:$LD_LIBRARY_PATH
export PYTHONPATH=$HOME/local/usr/local/lib/python2.7/site-packages/:$PYTHONPATH

Après ça

macports python2.Course 7


$ python2.7
Python 2.7.10 (default, Oct 18 2015, 09:28:19) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import opengm
>>> 

Recommended Posts

Comment installer OpenGM sur OSX avec macports
Comment installer Caffe sur OS X avec macports
Comment installer mysql-connector-python sur Mac
Comment installer python-pip avec ubuntu20.04LTS
Comment installer Graph-Tool sur macOS
Comment installer VMware-Tools sur Linux
Comment installer pycrypto sur Windows
Comment installer OpenCV sur Mac
Comment installer PyPy sur CentOS
Comment installer TensorFlow sur CentOS 7
Installez pyStruct sur MacOSX10.11 avec macports
Comment installer mysql-connector avec pip3
Comment installer Maven sur CentOS
Comment installer Music 21 sur Windows
Comment installer Anaconda avec pyenv
Comment installer Python2.7 python3.5 avec pyenv (sur RHEL5 CentOS5) (novembre 2016)
Comment installer Theano sur Mac OS X avec homebrew
Comment installer aws-session-manager-plugin sur Manajro Linux
Comment installer drobertadams / toggl-cli sur Mac
Comment installer DLIB avec 2020 / CUDA activé
Comment installer Richzhang / Colorisation sur Windows 10
Comment installer Apache (httpd) sur CentOS7
Comment installer php7.4 sur Linux (Ubuntu)
Comment installer Eclipse GlassFish 5.1.0 sur CentOS7
Comment installer Apache (httpd) sur CentOS8
Notes sur la façon d'exécuter Cython sur OSX
Comment installer zsh (avec la personnalisation .zshrc)
Comment installer NumPy sur Raspeye
Comment installer cx_Oracle sur macOS Sierra
Comment installer python3 avec docker centos
Comment installer des pandas sur EC2 (Comment gérer MemoryError et PermissionError)
[Version 2020] Comment installer Python3 sur EC2 d'AWS
Comment installer Python
Stratégie sur la façon de monétiser avec Python Java
Comment installer OpenCV sur Jetson Nano Python
Comment installer python
Comment installer rapidement h5py sur Windows 10 [non officiel]
Installez aws-cli sur MacPorts
Comment installer Nbextensions
Comment installer Camunda Modeler sur Manjaro Linux
[Python] Comment installer OpenCV sur Anaconda [Windows]
Installez pyenv sur OSX
Comment installer Prover9
Comment installer / vérifier Graphviz sur anaconda / windows10
Comment installer Linux sur un PC UEFI 32 bits
Comment installer Git GUI et Gitk sur CentOS
Autoencoder dans Chainer (Remarques sur l'utilisation de + trainer)
Comment déduire une estimation MAP de HMM avec OpenGM
[AWS EC2] Comment installer Maven sur Amazon Linux 2
Comment installer git sur Linux tel que EC2
Remarques sur la façon d'utiliser Firefox avec du sélénium sous Windows
[2020.8 dernière] Comment installer Python
Comment installer Python [Windows]
Comment installer Tabpy 1.0 (version 2020-01)
Comment s'inscrire auprès de pypi
Comment mettre à jour avec SQLAlchemy?
Comment lancer avec Theano
Comment installer mkl numpy
Comment modifier avec SQLAlchemy?