ImportError:没有名为' requests.exceptions'

时间:2018-01-16 04:10:30

标签: python anaconda conda

编码的新手,我正在尝试学习Python。我使用Anaconda管理软件包等。我通常使用conda update condaconda update anaconda

等命令更新cmd中的Anaconda / conda

最近,当使用这些命令时,它会出现一条消息:" ImportError:没有名为' Requests.exceptions'""然后是"导入错误:无法导入名称'会话'"请参阅下文。

Traceback (most recent call last):
  File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\main.py", line 171, in main
    activate.main()
  File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\activate.py", line 181, in main
    from ..install import symlink_conda
  File "C:\Program Files\Anaconda3\lib\site-packages\conda\install.py", line 37, in <module>
    from .core.package_cache import rm_fetched  # NOQA
  File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\package_cache.py", line 9, in <module>
    from .path_actions import CacheUrlAction, ExtractPackageAction
  File "C:\Program Files\Anaconda3\lib\site-packages\conda\core\path_actions.py", line 33, in <module>
    from ..gateways.download import download
  File "C:\Program Files\Anaconda3\lib\site-packages\conda\gateways\download.py", line 10, in <module>
    from requests.exceptions import ConnectionError, HTTPError, InvalidSchema, SSLError
ImportError: No module named 'requests.exceptions'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Anaconda3\Scripts\conda-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\main.py", line 179, in main
    return handle_exception(e)
  File "C:\Program Files\Anaconda3\lib\site-packages\conda\exceptions.py", line 634, in handle_exception
    print_unexpected_error_message(e)
  File "C:\Program Files\Anaconda3\lib\site-packages\conda\exceptions.py", line 596, in print_unexpected_error_message
    stderrlogger.info(get_main_info_str(get_info_dict()))
  File "C:\Program Files\Anaconda3\lib\site-packages\conda\cli\main_info.py", line 162, in get_info_dict
    from ..connection import user_agent
  File "C:\Program Files\Anaconda3\lib\site-packages\conda\connection.py", line 12, in <module>
    from requests import Session, __version__ as REQUESTS_VERSION
ImportError: cannot import name 'Session'

我尝试过使用像pip install requests这样的命令,但它说它已经说过&#34;要求已经满足并列出了安装位置(我猜)。

此时我甚至无法从像conda info --envs这样的conda命令中获得回复。当我输入时,它没有做任何事情。

如果我需要卸载conda / anaconda我会,但我只是错过了一个简单的修复?

谢谢朋友们!

1 个答案:

答案 0 :(得分:-1)

如果您计划将conda用作python环境,则应使用conda安装请求。

conda install requests