环境报错日记

文章讲述了四个常见的Python编程中遇到的问题,包括`distutils`版本缺失、`protobuf`升级引起的TypeError、`PIL.Image`模块属性错误和`scipy`的更新安装。给出了相应的解决方案,如安装特定版本的`setuptools`、降级或升级`protobuf`包以及更新`Pillow`库。
摘要由CSDN通过智能技术生成

1、AttributeError: module 'distutils' has no attribute 'version'

解决方案:pip install setuptools==59.5.0

2、TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

解决方案:pip install protobuf==3.20.*

3、Traceback (most recent call last):
  File "<module1>", line 19, in <module>
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

解决方案:pip uninstall Pillow
                  pip install Pillow==9.5.0

4、

解决方案:将红框部分 pip uninstall scipy             pip install -U scipy

                                    

5,pip install pyaudio错误

解决方案:conda install pyaudio

6,ImportError: cannot import name 'packaging' from 'pkg_resources'‘

解决方案:

检查setuptools是否为70.0.0版本:pip list | grep setuptools

降低版本:python -m pip install setuptools==69.5.1
 

  • 10
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值