我已经使用pip install安装了plyfile。然后我在名为“testview.py”的文件中执行了以下片段:
# Python imports
import sys, os
## Imports from this project
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'core'))
# hack to allow local imports without creaing a module or modifying the path variable
from InputOutput import *
from MeshDisplay import MeshDisplay
from HalfEdgeMesh import *
def main():
# Get the path for the mesh to load, either from the program argument if
# one was given, or a dialog otherwise
if(len(sys.argv) > 1):
filename = sys.argv[1]
else:
print("ERROR: No file name specified. Proper syntax is 'python testview.py path/to/your/mesh.obj'.")
exit()
# Read in the mesh
mesh = HalfEdgeMesh(readMesh(filename))
# Create a viewer window
winName = 'meshview -- ' + os.path.basename(filename)
meshDisplay = MeshDisplay(windowTitle=winName)
meshDisplay.setMesh(mesh)
meshDisplay.startMainLoop()
if __name__ == "__main__": main()
使用以下命令:
python testview.py ../meshes/bunny.obj
Traceback (most recent call last):
File "testview.py", line 13, in <module>
from InputOutput import *
File "../core/InputOutput.py", line 2, in <module>
from plyfile import PlyData, PlyElement, make2d
ImportError: No module named plyfile
如何检查plyfile确实已安装。我用以下命令安装了它:
sudo -H pip install plyfile
我得到了以上命令的以下输出:
Requirement already satisfied: plyfile in /usr/local/lib/python3.5/dist-packages
Requirement already satisfied: numpy>=1.8 in /usr/lib/python3/dist-packages (from plyfile)
顺便说一句,我在ubuntu上安装了python 2.7和python 3+。有些提示可以解决这个问题吗?