UBUNTU16.04,以python2.7创建了环境py2scrapy,
pip install pymongo,
import pymongo
在爬虫中出现错误:ImportError: No module named ‘pymongo‘
how do you find where pip install packages ? Run following command :
pip show pymongo
Name: pymongo Version: 3.6.0 Summary: Python driver for MongoDB <http://www.mongodb.org> Home-page: http://github.com/mongodb/mongo-python-driver Author: Bernie Hackett Author-email: [email protected] License: Apache License, Version 2.0 Location: /home/yun/.virtualenvs/py2scrapy/lib/python2.7/site-packages
vi ~/.bashrc
export PYTHONPATH=$PYTHONPATH:/home/yun/.virtualenvs/py2scrapy/lib/python2.7 /site-packages
source .bashrc
转: https://stackoverflow.com/questions/22885593/importerror-no-module-named-pymongo