复现早期的优化算法需要用到opendr,踩坑一天记录!!!
测试是否成功安装的命令
>>> import opendr
>>> opendr.demo("texture")
失败案例
python 3.8.15
numpy=1.23.0
mayavi=4.8.1
chumpy=0.70
cpython=3.0.0
报错一
安装opendr命令1:安装的版本是0.78
pip install opendr
截止目前我还找不到答案!
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/xucg/anaconda3/envs/barc/lib/python3.8/site-packages/opendr/__init__.py", line 350, in demo
exec('global np\n' + demos[which], globals(), locals())
File "<string>", line 5, in <module>
File "/home/xucg/anaconda3/envs/barc/lib/python3.8/site-packages/opendr/renderer.py", line 25, in <module>
from .contexts.ctx_mesa import OsContext
File "opendr/contexts/ctx_base.pyx", line 18, in init opendr.contexts.ctx_mesa
ModuleNotFoundError: No module named '_constants'
报错二
安装opendr命令2
参考链接中的手动安装,安装的是opendr版本是0.77
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/xucg/opendr/opendr/__init__.py", line 350, in demo
exec('global np\n' + demos[which], globals(), locals())
File "<string>", line 5, in <module>
File "/home/xucg/opendr/opendr/renderer.py", line 25, in <module>
from .contexts.ctx_mesa import OsContext
ModuleNotFoundError: No module named 'opendr.contexts.ctx_mesa'
报错三
安装opendr命令3
pip install git+https://gitlab.eecs.umich.edu/ngv-python-modules/opendr.git
报错依旧
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/xucg/opendr/opendr/__init__.py", line 350, in demo
exec('global np\n' + demos[which], globals(), locals())
File "<string>", line 5, in <module>
File "/home/xucg/opendr/opendr/renderer.py", line 25, in <module>
from .contexts.ctx_mesa import OsContext
ModuleNotFoundError: No module named 'opendr.contexts.ctx_mesa'
成功案例
我这个环境是重新建的
torch=1.9.0+cu111
python3.6.13
numpy=1.19.5
chumpy=0.70
cython=0.29.32
mayavi=4.8.0
安装opendr命令:安装的版本是0.78,无报错,但是有些细节需要修改
pip install opendr
在opendr安装的虚拟环境里面进行修改文章来源:https://www.toymoban.com/news/detail-634258.html
- ~/lib/python3.8/site-packages/opendr/common. 在467 行加入(int(verts_by_face.shape[0]/f.shape[1]).
- ~/lib/python3.8/site-packages/opendr/renderer.py 找到有dImage_wrt_2dVerts 函数的地方加入 int(self.v.r.size/3).
- ~/lib/python3.8/site-packages/opendr/camera.py 在 102 行加r入int(self.v.r.size*2/3).
正确的输出文章来源地址https://www.toymoban.com/news/detail-634258.html
http://files.is.tue.mpg.de/mloper/opendr/images/nasa_earth.mtl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/xucg/anaconda3/envs/smalr/lib/python3.6/site-packages/opendr/__init__.py", line 350, in demo
exec('global np\n' + demos[which], globals(), locals())
File "<string>", line 10, in <module>
File "/home/xucg/anaconda3/envs/smalr/lib/python3.6/site-packages/opendr/util_tests.py", line 22, in get_earthmesh
wg('http://files.is.tue.mpg.de/mloper/opendr/images/nasa_earth.mtl')
File "/home/xucg/anaconda3/envs/smalr/lib/python3.6/site-packages/opendr/util_tests.py", line 20, in wg
wget(url, dest)
File "/home/xucg/anaconda3/envs/smalr/lib/python3.6/site-packages/opendr/utils.py", line 37, in wget
open(dest_fname, 'w').write(contents)
TypeError: write() argument must be str, not bytes
>>>
到了这里,关于安装 opendr 踩坑记的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!