Closed Evi5 closed 4 years ago
solved! for the laters:
how to bindings with python3
change the default "python" command to python of version3 >python Python 3.6.9 (default, Nov 7 2019, 10:44:02) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.
cd ?/libcmaes/python run "g++ -fPIC -shared lcmaes.o -L../src/.libs -lboost_python3 -L/usr/lib -lpython3.6m -lcmaes -o lcmaes.so"
make install, that's done
>python3 ptest.py best x= [-1.785379181662181e-09, 2.395865195011826e-08, 6.061653453556779e-09, 1.5914100029626134e-08, -5.970297393178574e-09, -1.8894970502806234e-08, 1.0360807300590831e-08, 2.6325141749247337e-09, 5.7969264017946745e-09, 1.495768106660334e-08] distribution mean= [-6.677109579112475e-09, 1.897090478886326e-08, -4.453816041782483e-09, 7.911102194573172e-09, 1.3712575693847077e-09, -6.320228464795264e-09, 2.6798573503013194e-09, 1.243821781992354e-08, 1.1671293918848225e-08, 1.6542160588819193e-09] cov= [[ 9.80807967e-04 3.37520490e-05 1.61196988e-04 1.34859278e-05 6.31367667e-05 9.30363361e-05 1.15249735e-04 -4.55794152e-05 5.11121602e-05 8.73456256e-05] [ 3.37520490e-05 1.00972226e-03 -2.10128756e-04 1.54606478e-05 -9.82955596e-05 -8.67614257e-05 -1.24742884e-04 4.63080531e-05 2.24970878e-05 2.05279466e-04] [ 1.61196988e-04 -2.10128756e-04 7.99341125e-04 1.61874380e-04 1.75783164e-04 -1.29848024e-05 -4.54544836e-05 2.83638592e-05 -1.23174331e-04 1.16455188e-04] [ 1.34859278e-05 1.54606478e-05 1.61874380e-04 7.54443435e-04 -6.42782092e-05 5.63299437e-05 -7.44044801e-05 1.39047925e-05 4.90416505e-05 -1.35038792e-05] [ 6.31367667e-05 -9.82955596e-05 1.75783164e-04 -6.42782092e-05 1.15318318e-03 2.79877349e-04 -6.02842624e-05 -1.61853833e-04 1.05422770e-04 5.21854484e-05] [ 9.30363361e-05 -8.67614257e-05 -1.29848024e-05 5.63299437e-05 2.79877349e-04 8.41295975e-04 -8.72195806e-05 -3.32199120e-05 8.81145486e-05 -6.22200406e-05] [ 1.15249735e-04 -1.24742884e-04 -4.54544836e-05 -7.44044801e-05 -6.02842624e-05 -8.72195806e-05 7.64439898e-04 -2.27452576e-04 -6.88967982e-05 -6.80166273e-05] [-4.55794152e-05 4.63080531e-05 2.83638592e-05 1.39047925e-05 -1.61853833e-04 -3.32199120e-05 -2.27452576e-04 1.06013786e-03 -2.30531427e-05 -9.42283093e-05] [ 5.11121602e-05 2.24970878e-05 -1.23174331e-04 4.90416505e-05 1.05422770e-04 8.81145486e-05 -6.88967982e-05 -2.30531427e-05 1.00383612e-03 -1.59669438e-04] [ 8.73456256e-05 2.05279466e-04 1.16455188e-04 -1.35038792e-05 5.21854484e-05 -6.22200406e-05 -6.80166273e-05 -9.42283093e-05 -1.59669438e-04 9.11411320e-04]] elapsed time= 14 ms
ubuntu server 18.04, the default "python" command is python3
Follow the "Python bindings" https://github.com/beniz/libcmaes#python-bindings successful until run "python ptest.py" encountered an error:
It seemed that lcmaes.so used the wrong libboost_python-py27.so.1.65.1 instead of libboost_python3-py36.so.1.65.1
The lcmaes.so build with "g++ -fPIC -shared lcmaes.o -L../src/.libs -lboost_python -L/usr/lib -lpython3.6m -lcmaes -o lcmaes.so" It seemed that used python3.6, but libboost_python-py27.so.1.65.1 used in lcmaes.so
how can it use lcmaes in python3? thks