简体   繁体   中英

AttributeError: module 'os' has no attribute 'PathLike'

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.

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 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM