python执行出错, import requests 出错

用python什么版本的, 3.12.3版本时 , 安装requests包就报错

(midi_huoshan) PS D:\pythonProject\midi_huoshan> pip -V pip 22.3.1 from D:\Python310\midi_huoshan\Lib\site-packages\pip (python 3.12) (midi_huoshan) PS D:\pythonProject\midi_huoshan> (midi_huoshan) PS D:\pythonProject\midi_huoshan> (midi_huoshan) PS D:\pythonProject\midi_huoshan> pip install requests -i https://pypi.tuna.tsinghua.edu.cn/simple ERROR: Exception: Traceback (most recent call last): File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\cli\base_command.py", line 160, in exc_logging_wrapper status = run_func(*args) ^^^^^^^^^^^^^^^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\cli\req_command.py", line 247, in wrapper return func(self, options, args) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\commands\install.py", line 326, in run session = self.get_default_session(options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\cli\req_command.py", line 98, in get_default_session self._session = self.enter_context(self._build_session(options)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\cli\req_command.py", line 125, in _build_session session = PipSession( ^^^^^^^^^^^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\network\session.py", line 343, in init self.headers["User-Agent"] = user_agent() ^^^^^^^^^^^^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\network\session.py", line 175, in user_agent setuptools_dist = get_default_environment().get_distribution("setuptools") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\metadata\importlib_envs.py", line 188, in get_distribution return next(matches, None) ^^^^^^^^^^^^^^^^^^^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\metadata\importlib_envs.py", line 183, in matches = ( ^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\metadata\base.py", line 612, in iter_all_distributions for dist in self._iter_distributions(): File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\metadata\importlib_envs.py", line 176, in _iter_distributions for dist in finder.find_eggs(location): File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\metadata\importlib_envs.py", line 146, in find_eggs yield from self._find_eggs_in_zip(location) File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\metadata\importlib_envs.py", line 123, in _find_eggs_in_zip from pip.vendor.pkg_resources import find_eggs_in_zip File "D:\Python310\midi_huoshan\Lib\site-packages\pip_vendor\pkg_resources_init.py", line 2164, in register_finder(pkgutil.ImpImporter, find_on_path) ^^^^^^^^^^^^^^^^^^^ AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'? Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in run_code File "D:\Python310\midi_huoshan\Scripts\pip.exe_main.py", line 7, in File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\cli\main.py", line 70, in main return command.main(cmd_args) ^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\cli\base_command.py", line 101, in main return self._main(args) ^^^^^^^^^^^^^^^^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\cli\base_command.py", line 216, in _main self.handle_pip_version_check(options) File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\cli\req_command.py", line 179, in handle_pip_version_check session = self._build_session( ^^^^^^^^^^^^^^^^^^^^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\cli\req_command.py", line 125, in _build_session session = PipSession( ^^^^^^^^^^^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\network\session.py", line 343, in init self.headers["User-Agent"] = user_agent() ^^^^^^^^^^^^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\network\session.py", line 175, in user_agent setuptools_dist = get_default_environment().get_distribution("setuptools") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\metadata\importlib_envs.py", line 188, in get_distribution return next(matches, None) ^^^^^^^^^^^^^^^^^^^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\metadata\importlib_envs.py", line 183, in matches = ( ^ File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\metadata\base.py", line 612, in iter_all_distributions for dist in self._iter_distributions(): File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\metadata\importlib_envs.py", line 176, in _iter_distributions for dist in finder.find_eggs(location): File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\metadata\importlib_envs.py", line 146, in find_eggs yield from self._find_eggs_in_zip(location) File "D:\Python310\midi_huoshan\Lib\site-packages\pip_internal\metadata\importlib_envs.py", line 123, in _find_eggs_in_zip from pip.vendor.pkg_resources import find_eggs_in_zip File "D:\Python310\midi_huoshan\Lib\site-packages\pip_vendor\pkg_resources_init.py", line 2164, in register_finder(pkgutil.ImpImporter, find_on_path) ^^^^^^^^^^^^^^^^^^^ AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'? (midi_huoshan) PS D:\pythonProject\midi_huoshan>

936
1
1
avatar

百度一下

1
1评论
1
查看更多评论
avatar

百度一下

0
0评论
1
avatar

百度

1
0评论
2