Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.12报错 ModuleNotFoundError: No module named 'imp' #786

Open
DanielPPK opened this issue Mar 11, 2024 · 3 comments
Open

Python 3.12报错 ModuleNotFoundError: No module named 'imp' #786

DanielPPK opened this issue Mar 11, 2024 · 3 comments

Comments

@DanielPPK
Copy link

DanielPPK commented Mar 11, 2024

Python 3.12中删除了imp这个模块,因此在3.12下无法使用这个IP池
除了回退到3.11以外,后续是否有计划适配3.12及之后的版本?

@charles-wh
Copy link

下源码,改改就能用

@ZHHUAZH
Copy link

ZHHUAZH commented Apr 29, 2024

Python 3.12 报错:
1. from imp import reload as reload_six
ModuleNotFoundError: No module named 'imp'
解决方法:if PY3:
import importlib
reload_six = importlib.reload
else:
reload_six = reload
2. from collections import MutableMapping
ImportError: cannot import name 'MutableMapping' from 'collections'
解决方法:from collections.abc import MutableMapping
3. from collections import Iterable, Mapping
ImportError: cannot import name 'Iterable' from 'collections'
解决方法:from collections.abc import Iterable, Mapping
4. from .packages.six.moves.http_client import (
ModuleNotFoundError: No module named 'urllib3.packages.six.moves'
解决方法:更新urllib3包到最新版本
处理完这些问题 python proxyPool.py schedule 就正常启动了。

@ZHHUAZH
Copy link

ZHHUAZH commented Apr 29, 2024

Python 3.12 报错:执行 python proxyPool.py server 也会报好多错:

1.from jinja2 import Markup, escape
ImportError: cannot import name 'Markup' from 'jinja2'
解决方法:改成 from jinja2 import pass_eval_context
from markupsafe import Markup, escape

2.from itsdangerous import json as _json
ImportError: cannot import name 'json' from 'itsdangerous'
解决方法:改成 import json as _json

3.from collections import MutableMapping
ImportError: cannot import name 'MutableMapping' from 'collections'
解决方法:改成 from collections.abc import MutableMapping
然后就可以 get 到 代理地址 了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants