作者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://webptt.com/cn.aspx?n=bbs/Python/M.1516631453.A.FFB.html
1F:推 TitanEric: 猜是VS code没有得到conda的环境 读到是原本Ubuntu内建 01/23 01:41
2F:→ TitanEric: 的 01/23 01:41
3F:推 handsomeLin: 确认你终端机默认的python是不是conda和版本确认 01/23 02:42
4F:→ handsomeLin: 或是你前面要先import numpy? 01/23 02:43
5F:→ handsomeLin: 第二个是我猜测 我感觉应该不用 01/23 02:44
6F:推 AndyLee76: 先试试看在外面终端机直接打有没有这个套件 01/23 08:44
7F:→ owem0410: 有喔我用spyder是可以跑出结果的。然後numpy-stl是我第 01/23 12:57
8F:→ owem0410: 一个找不到的套件,之前的tensorflow是可以的 01/23 12:57
9F:推 craig1122321: 从终端机开vs-code看看 我之前用pytube有遇过类似的 01/24 20:41
10F:→ owem0410: 我一直都是使用terminal开启VS code 刚刚重开之後确认 01/25 18:08
11F:→ owem0410: 还是找不到==但是ipython可以... 01/25 18:09
12F:→ craig1122321: 重装看看? 01/25 22:29
13F:→ owem0410: 重新安装後还是一样...放弃 01/29 17:01
14F:→ nicks0904: 之前好像有看到说是pylint的问题 不知道跟你的状况有没 02/13 21:00
15F:→ nicks0904: 有关 02/13 21:00