我正在尝试从MongoDB环境连接到pyCharm。我使用python3.8并安装了pymongo、dnspython和dnspython3。
项目的我的设置是:

我的代码是:
from pymongo import MongoClient
import argparse
import dnspython
if __name__ == "__main__":
client = MongoClient("mongodb+srv://rajnesh:<myPassword>@cluster0-chffs.mongodb.net/test?authSource=admin&replicaSet=Cluster0-shard-0&readPreference=primary&appname=MongoDB%20Compass&ssl=true")
print("Hello there!")但是,我得到以下错误
回溯(最近一次调用):文件"/Users/rajnesh/pyProgram.py",第17行,在导入dnspython ModuleNotFoundError: No模块名为'dnspython‘
进程已完成,退出代码为%1
提前谢谢你的帮助。
发布于 2020-06-04 09:09:21
对于dnspython包,导入名为"dns“。有关这方面的更多信息可以在下面找到:
https://stackoverflow.com/questions/62190819
复制相似问题