简体   繁体   中英

Python cannot find mongoengine module

I've been trying to set up my first bottle server. I've started a virtualenv, installed bottle and mongoengine using pip. The problem is that even then I get the following error when I run the bottleApp.py to start the server

No module named mongoengine

in the line where I do

from mongoengine import *

I also found that my $PYTHONPATH has not been set in the virtualenv. Should I set $PYTHONPATH and $PATH manually to solve my issue ?

I am running on ArchLinux and the current version of arch now installs python 3.x by default I had installed python2 and python2-pip and installed bottle and mongoengine using pip2. Is it any dependency issue or a conflict that is causing this error ?

I am confused between the two. Need help.

Try the following command on terminal of Ububtu(Linux):

$pip install mongoengine

Then run the server again and the problem will be solved.

Did you check whether the package is actually installed?

In the virtualenv, could you try:

pip freeze | grep mongoengine

Yes, may be problems. Can try rebuilt virtual enviroment with python version you want.

For creating your virtualenv instance to specify the Python 2.7:

virtualenv -p /usr/bin/python2.7

After, you can install packages an appropriate way

pip install name_packege

or

pip install -r requirements.txt

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