作者owem0410 (閒學生)
看板Python
標題[問題] VS code 找不到library
時間Mon Jan 22 22:30:50 2018
抱歉打擾各位
我目前作業環境為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()
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.125.96.131
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1516631453.A.FFB.html
推 TitanEric: 猜是VS code沒有得到conda的環境 讀到是原本Ubuntu內建 01/23 01:41
→ TitanEric: 的 01/23 01:41
推 handsomeLin: 確認你終端機默認的python是不是conda和版本確認 01/23 02:42
→ handsomeLin: 或是你前面要先import numpy? 01/23 02:43
→ handsomeLin: 第二個是我猜測 我感覺應該不用 01/23 02:44
推 AndyLee76: 先試試看在外面終端機直接打有沒有這個套件 01/23 08:44
→ owem0410: 有喔我用spyder是可以跑出結果的。然後numpy-stl是我第 01/23 12:57
→ owem0410: 一個找不到的套件,之前的tensorflow是可以的 01/23 12:57
推 craig1122321: 從終端機開vs-code看看 我之前用pytube有遇過類似的 01/24 20:41
→ owem0410: 我一直都是使用terminal開啟VS code 剛剛重開之後確認 01/25 18:08
→ owem0410: 還是找不到==但是ipython可以... 01/25 18:09
→ craig1122321: 重裝看看? 01/25 22:29
→ owem0410: 重新安裝後還是一樣...放棄 01/29 17:01
→ nicks0904: 之前好像有看到說是pylint的問題 不知道跟你的狀況有沒 02/13 21:00
→ nicks0904: 有關 02/13 21:00