-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
-- Found Python3: /home/bing/miniconda3/bin/python3.1 (found version "3.11.5") found components: Interpreter Development Development.Module Development.Embed
Python 3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from OCC.Core.gp import gp_Pnt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'OCC'
复制代码
由上可知,当输入 from OCC.Core.gp import gp_Pnt 提示说OCC找不到,奇了怪了,查看github官方安装文档
If PYTHONOCC_INSTALL_DIRECTORY is unset, it will be installed to site-packages/OCC;如果PYTHONOCC_INSTALL_DIRECTORY未设置,将安装到site-packages/OCC,这个目次被设置为别的目次了,当时想着这个这类目次统一安装到/opt/pythonocc-core目次,谁知道这个目次不能乱设置;
site-packages这个目次三python的第三方依赖包的目次,以是默认环境,就会放在你的python的这个目次下,在python环境下,当import时,py就能正常找到库;
显然由前面的pythonocc的cmake阶段,被简单明确指定目次了;而一样平常环境下是不用修改的,主动会识别到python的site-packages目次的,当我们接纳的conda,有多个假造环境安装时,而我们又接纳了手动构建编译pythonocc包时,这是就需要指定这个目次到指定的conda假造环境中;
怎样查看当前python的第三方库目次呢,可以接纳如下方式查看
# 查看一下当前使用的python
$ which python
/home/myPC/miniconda3/bin/python
# 进入python
$ python
Python 3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.