pip install cmake pybind11 ninja
conda install -c conda-forge cmake pybind11 ninja ceres-solver
CMakeList.txt:
set(Python3_EXECUTABLE /path/to/bin/python)
set(pybind11_DIR /path/to/share/cmake/pybind11)
以上是在一个库里面看到的,主要实现python-cpp扩展,依赖ceres-solver eigen等
我尝试安装:
git clone https://******
~/bin/python -mpip install cmake pybind11 ninja
~/bin/conda install -c conda-forge cmake pybind11 ninja ceres-solver
sudo apt-get remove cmake
wget cmake-3.19.8.tar.gz
cd cmake-3.19.8
./configure
make
sudo make install
我以为用到的是apt安装的
ubuntu16.04
ninja (0.1.3-2) sudo apt-get install ninja
libeigen3-dev (3.3~beta1-2) sudo apt-get install libeigen3-dev
~/anaconda3/bin/conda env list
其实是conda自己的环境
因为python-cpp扩展涉及到编译,如果是cmake形式, 需要find第三方库的Find ceres-solver.cmake
那么我们正常方法需要cmake编译安装ceres-solver,但是这里使用conda去安装环境
激活conda
source ~/anaconda3/bin/activate root
或
source ~/anaconda3/bin/activate base
conda install -c conda-forge ceres-solver
https://anaconda.org/conda-forge/ceres-solver
会安装以下东西:
~/anaconda/pkgs/ceres-solver-2.0.0-h5e31d7b_0/lib
~/anaconda/pkgs/ceres-solver-2.0.0-h5e31d7b_0/info
~/anaconda/pkgs/ceres-solver-2.0.0-h5e31d7b_0/include
conda install -c conda-forge eigen
我这边默认是3.3.7
更新:
conda install -c conda-forge eigen==3.3.8
~/anaconda3/bin/conda list
看看安装了哪些
conda list
# packages in environment at /home/***/environment/py37_torch041:
#
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 1_gnu conda-forge
absl-py 0.12.0 pypi_0 pypi
argon2-cffi 20.1.0 pypi_0 pypi
async-generator 1.10 pypi_0 pypi
attrs 21.2.0 pypi_0 pypi
backcall 0.2.0 pypi_0 pypi
bleach 3.3.0 pypi_0 pypi
brotlipy 0.7.0 py37h27cfd23_1003
bzip2 1.0.8 h7f98852_4 conda-forge
ca-certificates 2021.5.30 ha878542_0 conda-forge
cachetools 4.2.2 pypi_0 pypi
ceres-solver 2.0.0 h5e31d7b_0 conda-forge
certifi 2021.5.30 py37h89c1867_0 conda-forge
cffi 1.14.3 py37h261ae71_2
chardet 3.0.4 py37h06a4308_1003
cmake 3.20.2 pypi_0 pypi
conda 4.10.1 py37h89c1867_0 conda-forge
conda-package-handling 1.7.2 py37h03888b9_0
cryptography 3.2.1 py37h3c74f83_1
decorator 5.0.9 pypi_0 pypi
defusedxml 0.7.1 pypi_0 pypi
eigen 3.3.7 hfd86e86_0
entrypoints 0.3 pypi_0 pypi
expat 2.4.1 h2531618_2
gflags 2.2.2 he1b5a44_1004 conda-forge
glog 0.4.0 h49b9bf7_3 conda-forge
google-auth 1.30.1 pypi_0 pypi
google-auth-oauthlib 0.4.4 pypi_0 pypi
grpcio 1.38.0 pypi_0 pypi
idna 2.10 py_0
importlib-metadata 4.2.0 pypi_0 pypi
ipykernel 5.5.5 pypi_0 pypi
ipython 7.23.1 pypi_0 pypi
ipython-genutils 0.2.0 pypi_0 pypi
ipywidgets 7.6.3 pypi_0 pypi
jedi 0.18.0 pypi_0 pypi
jinja2 3.0.1 pypi_0 pypi
jsonschema 3.2.0 pypi_0 pypi
jupyter-client 6.1.12 pypi_0 pypi
jupyter-core 4.7.1 pypi_0 pypi
jupyterlab-pygments 0.1.2 pypi_0 pypi
jupyterlab-widgets 1.0.0 pypi_0 pypi
krb5 1.18.2 h173b8e3_0
ld_impl_linux-64 2.33.1 h53a641e_7
libblas 3.9.0 9_openblas conda-forge
libcblas 3.9.0 9_openblas conda-forge
libcurl 7.71.1 h20c2e04_1
libedit 3.1.20191231 h14c3975_1
libffi 3.3 he6710b0_2
libgcc-ng 9.3.0 h2828fa1_19 conda-forge
libgfortran-ng 9.3.0 hff62375_19 conda-forge
libgfortran5 9.3.0 hff62375_19 conda-forge
libgomp 9.3.0 h2828fa1_19 conda-forge
liblapack 3.9.0 9_openblas conda-forge
libopenblas 0.3.15 pthreads_h8fe5266_1 conda-forge
libssh2 1.9.0 ha56f1ee_6 conda-forge
libstdcxx-ng 9.1.0 hdf63c60_0
libuv 1.41.0 h7f98852_0 conda-forge
lz4-c 1.9.2 he1b5a44_3 conda-forge
markdown 3.3.4 pypi_0 pypi
markupsafe 2.0.1 pypi_0 pypi
matplotlib-inline 0.1.2 pypi_0 pypi
metis 5.1.0 h58526e2_1006 conda-forge
mistune 0.8.4 pypi_0 pypi
nbclient 0.5.3 pypi_0 pypi
nbconvert 6.0.7 pypi_0 pypi
nbformat 5.1.3 pypi_0 pypi
ncurses 6.2 he6710b0_1
nest-asyncio 1.5.1 pypi_0 pypi
ninja 1.10.0.post2 pypi_0 pypi
notebook 6.4.0 pypi_0 pypi
numpy 1.20.3 pypi_0 pypi
oauthlib 3.1.0 pypi_0 pypi
open3d 0.9.0.0 pypi_0 pypi
opencv-python 4.5.1.48 pypi_0 pypi
openssl 1.1.1k h7f98852_0 conda-forge
packaging 20.9 pypi_0 pypi
pandocfilters 1.4.3 pypi_0 pypi
parso 0.8.2 pypi_0 pypi
pexpect 4.8.0 pypi_0 pypi
pickleshare 0.7.5 pypi_0 pypi
pillow 8.2.0 pypi_0 pypi
pip 20.2.4 py37h06a4308_0
prometheus-client 0.10.1 pypi_0 pypi
prompt-toolkit 3.0.18 pypi_0 pypi
protobuf 3.17.1 pypi_0 pypi
ptyprocess 0.7.0 pypi_0 pypi
pyasn1 0.4.8 pypi_0 pypi
pyasn1-modules 0.2.8 pypi_0 pypi
pybind11 2.6.2 pypi_0 pypi
pybind11-global 2.6.1 pypi_0 pypi
pycosat 0.6.3 py37h27cfd23_0
pycparser 2.20 py_2
pygments 2.9.0 pypi_0 pypi
pyopenssl 19.1.0 pyhd3eb1b0_1
pyparsing 2.4.7 pypi_0 pypi
pyrsistent 0.17.3 pypi_0 pypi
pysocks 1.7.1 py37_1
python 3.7.9 h7579374_0
python-dateutil 2.8.1 pypi_0 pypi
python_abi 3.7 1_cp37m conda-forge
pyzmq 22.1.0 pypi_0 pypi
readline 8.0 h7b6447c_0
requests 2.24.0 py_0
requests-oauthlib 1.3.0 pypi_0 pypi
rhash 1.4.1 h7f98852_0 conda-forge
rsa 4.7.2 pypi_0 pypi
ruamel_yaml 0.15.87 py37h7b6447c_1
send2trash 1.5.0 pypi_0 pypi
setuptools 50.3.1 py37h06a4308_1
six 1.15.0 py37h06a4308_0
sqlite 3.33.0 h62c20be_0
suitesparse 5.7.2 h717dc36_0 conda-forge
tbb 2020.2 hc9558a2_0 conda-forge
tensorboard 2.5.0 pypi_0 pypi
tensorboard-data-server 0.6.1 pypi_0 pypi
tensorboard-plugin-wit 1.8.0 pypi_0 pypi
terminado 0.10.0 pypi_0 pypi
testpath 0.5.0 pypi_0 pypi
tk 8.6.10 hbc83047_0
torch 0.4.1 pypi_0 pypi
torchvision 0.2.0 pypi_0 pypi
tornado 6.1 pypi_0 pypi
tqdm 4.51.0 pyhd3eb1b0_0
traitlets 5.0.5 pypi_0 pypi
typing-extensions 3.10.0.0 pypi_0 pypi
urllib3 1.25.11 py_0
wcwidth 0.2.5 pypi_0 pypi
webencodings 0.5.1 pypi_0 pypi
werkzeug 2.0.1 pypi_0 pypi
wheel 0.35.1 pyhd3eb1b0_0
widgetsnbextension 3.5.1 pypi_0 pypi
xz 5.2.5 h7b6447c_0
yaml 0.2.5 h7b6447c_0
zipp 3.4.1 pypi_0 pypi
zlib 1.2.11 h7b6447c_3
zstd 1.4.5 h9ceee32_0
还可以安装别人上传的,不是收录在conda-forge的
conda install -c saedrna openmvg
conda install -c hovren theiasfm
anaconda/pkgs/gflags-2.2.2-he1b5a44_1004/
anaconda/pkgs/gflags-2.2.2-he6710b0_0/
anaconda/pkgs/glog-0.4.0-h49b9bf7_3