You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何解决已尝试重装仍出现的‘ModuleNotFoundError: No module named 'requests'’?

Fixing ModuleNotFoundError: No module named 'requests' After Reinstall

It sounds like you’ve already tried the basic uninstall/reinstall for requests, but the error persists—let’s dig into why this might be happening and fix it step by step.

First, let’s recap what you’ve shared (from your command output):

(C:\Users\user\Anaconda3) C:\Users\user>Desktop\receipt.py
Traceback (most recent call last):
File "C:\Users\user\Desktop\receipt.py", line 8, in
import requests
ModuleNotFoundError: No module named 'requests'

(C:\Users\user\Anaconda3) C:\Users\user>pip uninstall requests
Uninstalling requests-2.18.4:
Would remove:
c:\users\user\anaconda3\lib\site-packages\requests-2.18.4.dist-info*
c:\users\user\anaconda3\lib\site-...

Common Causes & Fixes

  • Ensure you’re installing to the right Python environment
    Sometimes your system has multiple Python versions, and pip might be pointing to a different one than the one running your script. Instead of using plain pip, run this to guarantee you’re using the Anaconda environment’s pip:

    python -m pip install requests
    

    To verify alignment, check the paths of your Python and pip executables:

    # On Windows
    where python
    where pip
    

    Both should show paths inside C:\Users\user\Anaconda3\.

  • Force a clean reinstall (skip cache)
    Corrupted cache files can mess up installations. Run this to completely refresh your requests installation without using cached files:

    pip install --force-reinstall --no-cache-dir requests
    
  • Confirm your script is using the Anaconda Python
    Even if your command line shows the Anaconda environment, your script might be running with a different interpreter. Add these lines at the top of receipt.py and run it again:

    import sys
    print("Python executable path:", sys.executable)
    

    If the output isn’t C:\Users\user\Anaconda3\python.exe, you need to adjust your IDE or run settings to use the Anaconda Python interpreter.

  • Check for permission issues
    Sometimes Windows restricts installations to user-specific system folders. Try running your command prompt as Administrator, then reinstall requests with pip install requests.

Let me know if any of these steps resolve the issue for you!

内容的提问来源于stack exchange,提问作者Ada

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 07:47:52