An error is reported during the operation of scrapy, ModuleNotFoundError: No module named 'pymongo'

I run the single file directly without import errors. In addition, it is normal for me to use mongodb in the py file alone, but when I run it in the scrapy project, I will say that the import failed. Why?

import json
import pymongo
from scrapy.utils.project import get_project_settings


class MyscrapyPipeline(object):

    def __init__(self):
        settings = get_project_settings()
        client = pymongo.MongoClient(host=settings["MONGODB_HOST"], port=settings["MONGODB_PORT"])
        db = client[settings["MONGODB_DBNAME"]]
        self.mongo = db[settings["MONGODB_COLNAME"]["taptap"]]

    def process_item(self, item, spider):
        """  """

        for k, v in item.items():
            item[k] = "".join(v.split()) if bool(type(v) is not list) else v

        self.mongo.insert_one(json.dumps(dict(item), ensure_ascii=False))

        return item
Does

use some integrated development compiler ? there is no pymongo in your scrapy project development environment, if the compiler is pycharm or Spyder . This Q & A may help you modify the Python environment :
https://codeshelper.com/q/10...

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e7ce4a-910.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e7ce4a-910.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?