运行刘焕勇老师的CMKG的爬虫程序时:
报错1:
Collection' object is not callable. If you meant to call the 'insert' method on a 'Collection' object it is failing because no such method exists
原因:版本问题。解决:卸载然后装特定版本
pip uninstall pymongo
pip install pymongo==3.5.1
报错2:
localhost:27017: [Errno 111] Connection refused
原因:可能是没有启用mongodb服务
解决:Linux终端也就是terminal运行以下代码。win里叫法不同,叫命令行
systemctl start mongodb.service
解决systemctl start mongodb.service的报错:
所以之后很长一段路都真的是在解决systemctl start mongodb.service的报错
报错:
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
原因:systenctl没有安装或者无法正常使用,所以要下载它,输入以下代码
sudo apt install systemctl
然后报错:
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: 错误,pkgProblemResolver::Resolve 发生故障,这可能是有软件包被要求保持现状的缘故。 E: 无法更正依赖关系
(举例子)
下列软件包有未满足的依赖关系:
mentohust:i386 : 依赖: libpcap0.8:i386 但是它将不会被安装 或
libpcap0.9:i386 但无法安装它 或
libpcap1.0:i386 但无法安装它 或
libpcap1:i386 但无法安装它
wps-office : 依赖: libc6:i386 (>= 2.12) 但是它将不会被安装
依赖: libstdc++6:i386 (>= 4.5) 但是它将不会被安装
依赖: libfreetype6:i386 (>= 2.4) 但是它将不会被安装
依赖: libglu1-mesa:i386 但是它将不会被安装
依赖: libcups2:i386 但是它将不会被安装
依赖: libglib2.0-0:i386 但是它将不会被安装
依赖: libsm6:i386 但是它将不会被安装
依赖: libxrender1:i386 但是它将不会被安装
依赖: libfontconfig1:i386 但是它将不会被安装
推荐: ttf-mscorefonts-installer 但是它将不会被安装
————————————————
原文链接:https://blog.youkuaiyun.com/weixin_42156097/article/details/103805063
解决:
sudo aptitude install systemctl
若报错:没有"aptitude"这个命令:
sudo: aptitude: command not found

本文记录了在Ubuntu20.04上安装MongoDB的过程,包括解决版本不匹配、服务启动失败、依赖冲突等问题。通过卸载并安装指定版本的pymongo,然后处理systemctl启动mongodb.service时遇到的各种错误,如System has not been booted with systemd in init system等,最终成功启动MongoDB服务。
最低0.47元/天 解锁文章
424

被折叠的 条评论
为什么被折叠?



