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

Python3.5下已通过pip/Anaconda安装TensorFlow仍提示找不到模块错误

Troubleshooting ImportError: No module named 'tensorflow' in Python 3.5

Hey there, let’s work through why your TensorFlow import is failing even after installing it with pip and Anaconda. I’ve hit this exact snag a handful of times, so here are the most reliable fixes to try:

1. Double-check you’re using the right Python environment

This is by far the most common culprit. You might have installed TensorFlow in one environment but be running your script in a totally different one.

  • First, confirm which Python interpreter you’re invoking:
    which python3  # macOS/Linux
    where python3  # Windows
    
    Note the path it outputs—this is the Python your script is using.
  • Next, verify where TensorFlow was installed:
    • For pip: Run pip3 show tensorflow and check the Location field. It should match the site-packages directory of the Python path you just noted.
    • For Anaconda: Run conda info --envs to list all your environments, then make sure you’re activated in the right one with conda activate <your-env-name>. Then run conda list tensorflow to confirm it’s installed there.

2. Use the correct pip/conda for your environment

Mixing system-wide pip/conda with your Anaconda environment’s tools is an easy mistake to make.

  • If you’re using Anaconda, always activate your environment first before installing:
    conda activate your-env-name
    conda install tensorflow
    
  • If you prefer pip with Anaconda, use the pip that’s tied to your active environment (this avoids system pip conflicts):
    conda activate your-env-name
    python -m pip install tensorflow
    
    Using python -m pip guarantees you’re using the pip associated with the Python you’re currently working with.

3. Install a TensorFlow version compatible with Python 3.5

Important heads-up: TensorFlow dropped support for Python 3.5 starting with version 2.0. So if you tried installing the latest TensorFlow, it won’t show up in your 3.5 environment. You need to install the last compatible version:

  • With pip:
    python -m pip install tensorflow==1.15
    
  • With Anaconda:
    conda config --add channels conda-forge  # If conda can't find the package initially
    conda install tensorflow=1.15
    

4. Verify the installation actually worked

After installing, run this quick test in your terminal (make sure your environment is activated) to confirm TensorFlow is accessible:

python -c "import tensorflow as tf; print(tf.__version__)"

If this works, the problem is with how you’re running your script—like using the wrong interpreter in your IDE.

5. Fix IDE interpreter mismatch

If you’re using VS Code, PyCharm, or another IDE:

  • VS Code: Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS), search for "Python: Select Interpreter", and pick the conda environment/Python path where you installed TensorFlow.
  • PyCharm: Go to File > Settings > Project: [Your Project] > Python Interpreter, click the gear icon, select "Add", and choose the correct conda environment or Python executable.

Start with these steps in order—chances are it’s either an environment mix-up or an incompatible TensorFlow version for Python 3.5. Let me know if any of these get you up and running!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.22 07:47:35