问题
I have tried installing pymesh
on both Mac OS and Windows, by downloading the source and installing using python setup.py install
(as described in https://github.com/qnzhou/PyMesh).
In both cases, when I then ran the test code: python -c "import pymesh; pymesh.test()"
, I get an ImportError. E.g., in Windows, I get the following traceback:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\Anaconda2\lib\site-packages\pymesh2-0.1.14-py2.7-win-amd64.egg\pymesh\__init__.py", line 18, in <module>
from .Mesh import Mesh
File "C:\Program Files\Anaconda2\lib\site-packages\pymesh2-0.1.14-py2.7-win-amd64.egg\pymesh\Mesh.py", line 5, in <module>
import PyMesh
ImportError: No module named PyMesh
What is going on?
回答1:
Ok, don't be worried. If you use the virtual environment to manage the python version. So you can solve this problem by the following:
cd $PYMESH_PATH
mkdir build
cd build
cmake -DPYTHON_LIBRARY=/Users/user/.pyenv/versions/anaconda3-5.2.0/lib/libpython3.6m.dylib -DPYTHON_INCLUDE_DIR=/Users/user/.pyenv/versions/anaconda3-5.2.0/include/python3.6m -DPYTHON_EXECUTABLE:FILEPATH=/Users/user/.pyenv/versions/anaconda3-5.2.0/bin/python ..
make -j
cd ..
python setup.py install
You can also refer to this.
This solved my problem.
Good Luck!!
来源:https://stackoverflow.com/questions/50205891/importerror-no-module-named-pymesh