抱歉打擾各位
我目前作業環境為Ubuntu 16.04
套件用conda 管理
今天想要嘗試numpy-stl套件
下述範例讀取.stl檔
使用Vs code 卻有ImportError: No module named stl
但是我在vs code裡終端機裡打conda list有看到numpy-stl
所以我是那邊沒有設定好?
讀取範例程式碼:
from stl import mesh
from mpl_toolkits import mplot3d
from matplotlib import pyplot
# Create a new plot
figure = pyplot.figure()
axes = mplot3d.Axes3D(figure)
# Load the STL files and add the vectors to the plot
your_mesh = mesh.Mesh.from_file('/home/chen/sample3.stl')
axes.add_collection3d(mplot3d.art3d.Poly3DCollection(your_mesh.vectors))
# Auto scale to the mesh size
scale = your_mesh.points.flatten(-1)
axes.auto_scale_xyz(scale, scale, scale)
# Show the plot to the screen
pyplot.show()
猜是VS code沒有得到conda的環境 讀到是原本Ubuntu內建的
確認你終端機默認的python是不是conda和版本確認或是你前面要先import numpy?第二個是我猜測 我感覺應該不用
作者: AndyLee76 (AndyLee) 2018-01-23 08:44:00
先試試看在外面終端機直接打有沒有這個套件
有喔我用spyder是可以跑出結果的。然後numpy-stl是我第一個找不到的套件,之前的tensorflow是可以的
作者: craig1122321 (半醉夜貓) 2018-01-24 20:41:00
從終端機開vs-code看看 我之前用pytube有遇過類似的
我一直都是使用terminal開啟VS code 剛剛重開之後確認還是找不到==但是ipython可以...
作者: craig1122321 (半醉夜貓) 2018-01-25 22:29:00
重裝看看?
之前好像有看到說是pylint的問題 不知道跟你的狀況有沒有關