python setup.py 的操作无法理解

问题遇到的现象和发生背景

处理数据集时

问题相关代码,请勿粘贴截图

root@202120085400040-0:/workspace/555/mesh-fusion-master# python 2_fusion.py --mode=render --in_dir=examples/1_scaled/ --depth_dir=examples/2_depth/ --out_dir=examples/2_watertight/
Traceback (most recent call last):
File "2_fusion.py", line 10, in
import librender
File "/workspace/555/mesh-fusion-master/librender/init.py", line 5, in
ctypes.cdll.LoadLibrary(os.path.join(pyrender_dir, 'pyrender.so'))
File "/usr/lib/python3.6/ctypes/init.py", line 426, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python3.6/ctypes/init.py", line 348, in init
self._handle = _dlopen(self._name, mode)
OSError: /workspace/555/mesh-fusion-master/librender/pyrender.so: cannot open shared object file: No such file or directory

我的解答思路和尝试过的方法

在gtihub上有答主回答了这个问题,但是我无法理解那个操作
Ok found the solution:
in librender directory the command python setup.py ... created a file pyrender.cpython-36m-x86_64-linux-gnu.so.
I copied this file into root directory mesh-fusion and renamed it into pyrender.so
In librender.init.py i changed line 5 into
ctypes.cdll.LoadLibrary(os.path.join(pyrender_dir, '../pyrender.so'))
Similarly, in libfusioncpu the file cyfusion.cpython-36m-x86_64-linux-gnu.so was generated. I copied it into root directory mesh-fusion and renamed it into cyfusion.so
Then code works.

我想要咨询

用python setup.py 生成一个.so文件是如何操作的呢?就是这一句
in librender directory the command python setup.py ... created a file pyrender.cpython-36m-x86_64-linux-gnu.so.

首先运行setup.py看有没有自动生成该文件,如有按操作步骤往下进行,如果没有,就尝试用gcc或g++进行编译生成.so文件。

g++ -shared -o t1.so -fPIC t1.cpp
参考:
https://stackoverflow.com/questions/14884126/build-so-file-from-c-file-using-gcc-command-line

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632