复现早期的优化算法需要用到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 "" , 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 "" , 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 "" , line 1, in <module>
File "/home/xucg/opendr/opendr/__init__.py", line 350, in demo
exec('global np\n' + demos[which], globals(), locals())
File "" , 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 "" , line 1, in <module>
File "/home/xucg/opendr/opendr/__init__.py", line 350, in demo
exec('global np\n' + demos[which], globals(), locals())
File "" , 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安装的虚拟环境里面进行修改
正确的输出
http://files.is.tue.mpg.de/mloper/opendr/images/nasa_earth.mtl
Traceback (most recent call last):
File "" , 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 "" , 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
>>>