首页 > 系统相关 >解决CentOS pyhon3 ModuleNotFoundError: No module named "_bz2"问题

解决CentOS pyhon3 ModuleNotFoundError: No module named "_bz2"问题

时间:2023-02-13 14:11:05浏览次数:39  
标签:named bz2 CentOS No module File line

在运行Python项目的时候出现了No module named '_bz2'错误

File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/software/architonic/architonic_p3/lib/python3.11/site-packages/scrapy/extensions/feedexport.py", line 23, in <module>
    from scrapy.extensions.postprocessing import PostProcessingManager
  File "/software/architonic/architonic_p3/lib/python3.11/site-packages/scrapy/extensions/postprocessing.py", line 4, in <module>
    from bz2 import BZ2File
  File "/usr/local/python3/lib/python3.11/bz2.py", line 17, in <module>
    from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'

 解决办法

 先安装bzip2 bzip2-devel

yum -y install bzip2 bzip2-devel

 其次重新编译Python3

./configure --prefix=/usr/local/python3 --with-ssl --enable-optimozations
make && make install

至此,错误解决

标签:named,bz2,CentOS,No,module,File,line
From: https://www.cnblogs.com/xiaonian/p/17116146.html

相关文章

  • CentOS安装docker --MYSQL
    准备检测系统版本和内核版本  安装自动安装脚本curl -sSL https://get.daocloud.io/docker | sh  启动docker  搜索docker可用资源dockersearch......
  • 查看linux是centos还是ubuntu的方法
    以下总结了4种区分centos和ubuntu系统的方法。1、lsb_release-a如果是想查看你的Linux系统是Ubuntu还是CentOS,可以使用lsb_release-a命令,lsb_release-a命令可以列出你......
  • CentOS7下缺少头文件处理办法
    联网状态下可以使用provides查询依赖项,如缺少libusb.h,可使用:yumprovides*/libusb.h  执行yuminstall libusbx-devel安装完成即可。......
  • centos下安装部署nginx
    1.在安装Nginx之前,要确保已经安装了需要的软件:gcc、pcre-devel、zlib-devel、openssl-devel。如果没有安装,执行下面命令。  yum-yinstallgccpcre-develzlib-deve......
  • CentOS7 更换阿里云镜像源
    前戏需要有服务器或虚拟机操作系统为Centos7的环境手动配置备份官方的原yum源的配置此步骤必不可少mv/etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Bas......
  • Wsl2安装CentOS7
    Wsl2安装CentOS7(或任何你想安装的Linux发行版)前提条件:安装了虚拟机,且安装好了Docker找到你想要的CentOS版本CentOS的DockerHub地址下载docker镜像(我这里是因......
  • centos7部署redis
    参考文档https://redis.io/docs/getting-started/installation/install-redis-from-source/https://blog.csdn.net/weixin_45550937/article/details/1240920771、安......
  • naabu linux 下使用 -centos
    版本naabu端口扫描工具在linux运行出现错误解决方法yuminstall-ylibpcap-devel或aptinstall-ylibpcap-dev查找上述安装的文件位置locatelibpcap(......
  • [学习笔记] CentOS + .Net后端常用的中间件工具安装
    Redis5.0+官方文档:https://redis.io/download/#redis-downloadssudoyuminstallredisRabbitMQ3.7.11+官方文档:https://www.rabbitmq.com/install-rpm.html配置安......
  • Centos7用rpm安装MySQL数据库
    在Centos7下使用rpm安装下mysql的流程: 首先进入mysql官网的下载地址:​​ https://dev.mysql.com/downloads/mysq​​l/,然后在下载里面把os选择为RedHatEnterpriseLin......