问题
AttributeError: module ‘os’ has no attribute ‘PathLike’
您遇到的错误主要是由于 Python 3.5 版本过旧,导致某些现代库(如 certifi
和 requests
)使用了在 Python 3.6 及以上版本中引入的功能(例如 os.PathLike
)。要解决这个问题,您有两个主要选择:
- 升级 Python 至 3.6 或更高版本(推荐)
- 降级相关库到兼容 Python 3.5 的版本
以下是详细的解决方案:
推荐方案 1:升级 Python 至 3.6 或更高版本
升级 Python 是解决此类兼容性问题的最佳方式。
步骤如下:
-
更新包列表并安装必要的依赖
sudo apt-get update sudo apt-get install -y software-properties-common
- <