简体   繁体   中英

python can't find already installed Module

Guys! I'm using python 2.7 in windows by personal Reason. Then I wanna use 'pymesh' library for some works. but although the 'pymesh' module is already installed by using

python setup.py install

, the python show me this error message

Traceback (most recent call last):

File "", line 1, in

File "E:\\ProgramData\\Anaconda2\\lib\\site-packages\\pymesh-0.1-py2.7.egg\\pymesh__init__.py", line 18, in

from .Mesh import Mesh

File "E:\\ProgramData\\Anaconda2\\lib\\site-packages\\pymesh-0.1-py2.7.egg\\pymesh\\Mesh.py", line 5, in

import PyMesh

ImportError: No module named PyMesh

and because I thought that the reason of this error is I didn't build 'pymesh', I entered this code in CMD

python setup.py build

but the prompt also show me error message

running build

Overriding default build process

error: [Error 2]

so ... in this case , how can i fix this simple problem

I guess you probably have to mention the pip version you are trying to install with, this happens if you have multiple versions of python/pip installed so if you are using python2.7 then use pip2.

pip2 install pymesh

then try importing it!

import pymesh

I managed to make it work. I will post the procedure I adopted. I use Debian 9.13 .
I believe it will works for debian likes. I also apologize for my google translator english

I did the following steps to install PyMesh

Optional - Set the python version as the system default. I chose to do it because I have other versions of python on my system. `# update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1

1. Installing dependencies Here I used administrator permission for installation via apt-get.

# apt install libeigen3-dev libgmp-dev libgmpxx4ldbl libmpfr-dev libboost-dev libboost-thread-dev libtbb-dev python3-dev curl git -y

Pip installation

# curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python get-pip.py

2. clone, part of third parties and requirements As a common user of the system.

$ git clone https://github.com/PyMesh/PyMesh.git

$ cd PyMesh

$ git submodule update --init

$ export PYMESH_PATH=`pwd`

$ pip install -r $PYMESH_PATH/python/requirements.txt

3. Install CMAKE

When getting errors in the build step, I noticed that the messages pointed to my outdated version of CMAKE. I upgraded (version 3.13.4) using the Debian Buster repository. You may prefer to build from sources. I chose to use apt-get.

# echo "deb http://deb.debian.org/debian buster main" >> /etc/apt/sources.list.d/buster.list

# apt update && apt install cmake -y

4. Build and install

Still in the PyMesh directory, with a common user.

$ ./setup.py build

$ ./setup.py install --user

5. Test

$ python -c "import pymesh; pymesh.test()"

reference links

https://pymesh.readthedocs.io/en/latest/ https://github.com/PyMesh/PyMesh https://linuxconfig.org/how-to-change-default-python-version-on-debian-9-stretch-linux https://pip.pypa.io/en/stable/installing/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM