attributeError:模块' os'没有属性' pathike'

发布于 2025-01-30 13:28:54 字数 90 浏览 3 评论 0 原文

我想在Python 3.5中运行OS。不幸的是,这在Python 3.5中不可用。是否有一个周转,可以在Python 3.5中运行此命令,而无需升级Python版本。

I want to run os.PathLike in python 3.5. Unfortunately this is not available in python 3.5. Is there a turnaround in which I can run this command in python 3.5 without upgrading the python version.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

审判长 2025-02-06 13:28:54

欢迎来到依赖地狱。由于Python 3.5被折旧,许多新版本的模块都使用3.6语法,这会导致此类问题。我只是解决了一个类似的问题。检查堆栈trance并查找哪个模块丢弃该错误,然后删除该版本的版本,并找到兼容的旧版本。

在我的情况下,更新了Python模块,并且 ceeldifi 模块正在破坏PIP3,而您看到的错误相同。我在。然后在此之后删除模块

sudo rm -rf <python3.5_path>/dist-packages/certifi

,我能够使用 python3 -m pip eg

sudo python3 -m pip uninstall requests
python3 -m pip install requests==2.19.0   # This reinstalls certifi-2022.6.15-py3-none-any.whl which breaks in python 3.5
rm -rf /home/ssm-user/.local/lib/python3.5/site-packages/certifi
python3 -m pip install certifi==2021.10.8

Welcome to dependency hell. Since python 3.5 is depreciated many new version of modules are using 3.6 syntax which causes problems like this. I just resolved a similar issue. Check the stack trance and find which module is throwing that error then delete that version of it and find an older version that's compatible.

In my case python modules were updated and the certifi module was breaking pip3 with the same error you're seeing. I found a compatible version of it on https://pypi.org/project/certifi. Then deleted the module like this

sudo rm -rf <python3.5_path>/dist-packages/certifi

After this I was able to use python3 -m pip e.g.

sudo python3 -m pip uninstall requests
python3 -m pip install requests==2.19.0   # This reinstalls certifi-2022.6.15-py3-none-any.whl which breaks in python 3.5
rm -rf /home/ssm-user/.local/lib/python3.5/site-packages/certifi
python3 -m pip install certifi==2021.10.8
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文