biref 2022-03-02 13:53 采纳率: 57.1%
浏览 44
已结题

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.

  • 写回答

2条回答 默认 最新

  • CSDN专家-HGJ 2022-03-02 14:19
    关注

    首先运行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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 3月11日
  • 已采纳回答 3月3日
  • 创建了问题 3月2日

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么