图中未显示conda下的Jupyter fresh install和使用viewscad上游示例

2024-05-15 20:37:02 发布

您现在位置:Python中文网/ 问答频道 /正文

以下是在Debian 9中重现该问题的环境(我必须添加lib3mf1_1.8.1+ds-3_amd64.deb、lib3mf-dev_1.8.1+ds-3_amd64.deb、它的工具_2.0.5-2_all.deb,它们不在存储库中,带有dpkg -iapt install -f):

# install openscad
cd /opt
git clone git://github.com/openscad/openscad.git
cd openscad
git submodule update --init
sudo ./scripts/uni-get-dependencies.sh
./scripts/check-dependencies.sh # lib3mf was missing
qmake openscad.pro
make # itstool was missing
cp /opt/openscad/openscad /usr/local/bin/
# setup a conda environment and install jupyterlab, solidpython, viewscad
conda create --name cad python=3
conda activate cad
conda install -y -n cad jupyterlab
pip install solidpython
pip install viewscad
# for jupyterlab:
conda install -c conda-forge -n cad nodejs
jupyter labextension install @jupyter-widgets/jupyterlab-manager

然后运行jupyter(这里是jupyter笔记本)

jupyter-notebook

在浏览器中打开的jupyter中启动python项目,并在第一个单元格中输入:

from solid import *
import viewscad
r = viewscad.Renderer()
#r = viewscad.Renderer(openscad_exec='/opt/openscad')
c = cylinder(r = 5, h = 2)
r.render(c)

结果是:

VBox(children=(HTML(value=''), Renderer(background='#cccc88', background_opacity=0.0, camera=PerspectiveCamera…

而不是像简化的上游示例here中那样显示图形

如果我在renderer调用中指定openscad的路径,比如建议的here和上面的注释行中,它是相同的

如果我用numpy而不是viewscad, solidscad, openscad测试另一个脚本,将显示图。openscad和solidscad各自都在工作。所以,我想我的问题与我的viewscad设置有关


Tags: installgitdscddebjupytercondaamd64
1条回答
网友
1楼 · 发布于 2024-05-15 20:37:02

我遇到了同样的问题,花了一段时间才意识到我没有正确安装pythreejs。尝试运行您作为管理员使用的任何提示,并检查pythreejs的完整安装

pip install pythreejs
jupyter nbextension install  py  symlink  sys-prefix pythreejs
jupyter nbextension enable  py  sys-prefix pythreejs

这帮我解决了问题,使用了Python提示

相关问题 更多 >