yfeng95 / face3d

Python tools for 3D face: 3DMM, Mesh processing(transform, camera, light, render), 3D face representations.
2.65k stars 611 forks source link

ImportError: No module named cython #26

Open zhangyonle opened 5 years ago

zhangyonle commented 5 years ago

Traceback (most recent call last): File "1_pipeline.py", line 12, in import face3d File "/home/zhangyongle/face3d/examples/face3d/init.py", line 1, in from . import mesh File "/home/zhangyongle/face3d/examples/face3d/mesh/init.py", line 1, in from .cython import mesh_core_cython ImportError: No module named cython

emadeldeen24 commented 5 years ago

you can use the mesh_numpy version instead, and you will have to replace every "mesh" with "mesh_numpy" in all files you use.

gsssrao commented 5 years ago

@zhangyonle You just need to create an empty file by the name __init__.py in that directory i.e face3d/mesh/cython. To do that just go to that directory and run the following command:

touch __init__.py

The error is because, python doesn't recognize the folder cython as module for importing from it. For a folder to be recognized as a module, it needs to have __init__.py in it. It doesn't matter if it has something or if it is empty, python just needs it to be present in that directory.

As long as you have compiled the C++ files as per the instructions here, everything should work fine.

Zwei-Eric commented 5 years ago

@zhangyonle You just need to create an empty file by the name __init__.py in that directory i.e face3d/mesh/cython. To do that just go to that directory and run the following command:

touch __init__.py

The error is because, python doesn't recognize the folder cython as module for importing from it. For a folder to be recognized as a module, it needs to have __init__.py in it. It doesn't matter if it has something or if it is empty, python just needs it to be present in that directory.

As long as you have compiled the C++ files as per the instructions here, everything should work fine.

It solves my problem, thanks a lot.

codgodtao commented 4 years ago

@gsssrao but another problem 'cannot find refferences 'mesh_core_cython' in 'init.py'' came out how to solve it? image