Of course. Using Python 3.6 with TensorFlow is a common scenario, especially when maintaining older projects or working with specific dependencies. Here’s a comprehensive guide covering installation, key considerations, and best practices.

Important Considerations Upfront
Before you install, it's crucial to understand the context:
- Python 3.6 is End-of-Life (EOL): Python 3.6 reached its official end-of-life on December 23, 2025. This means it no longer receives security updates, bug fixes, or improvements.
- TensorFlow 1.x vs. 2.x: This is the most critical distinction.
- TensorFlow 1.x: The last version to officially support Python 3.6 was TensorFlow 1.15.
- TensorFlow 2.x: TensorFlow 2.x dropped support for Python 3.6 starting with version 11. The last version of TF 2.x to support Python 3.6 was 10.
Conclusion: If you are using Python 3.6, you are almost certainly working with a legacy project that requires TensorFlow 1.x.
Installation Guide
You have two main options: using a pre-compiled binary or building from source. For most users, the binary is the way to go.
Option A: Install a Pre-Compiled Binary (Recommended)
This is the simplest and most common method. It will work for most standard CPU and GPU setups.

For TensorFlow 1.x (Last version for Python 3.6)
This is the recommended choice if you are on Python 3.6.
# It's best practice to use a virtual environment python3.6 -m venv tf1-env source tf1-env/bin/activate # On Windows, use `tf1-env\Scripts\activate` # Install the last version of TensorFlow 1.x that supports Python 3.6 pip install tensorflow==1.15.0
For TensorFlow 2.x (Last version for Python 3.6)
Only use this if your project absolutely requires TensorFlow 2.x features and you are stuck on Python 3.6.

# It's best practice to use a virtual environment python3.6 -m venv tf2-env source tf2-env/bin/activate # On Windows, use `tf2-env\Scripts\activate` # Install the last version of TensorFlow 2.x that supports Python 3.6 pip install tensorflow==2.10.0
Option B: Install GPU Support (Advanced)
If you have an NVIDIA GPU and want to accelerate your models, you need to install the tensorflow-gpu package and the necessary CUDA and cuDNN libraries.
Important: The versions of CUDA and cuDNN must be compatible with the version of TensorFlow you choose.
| TensorFlow Version | Python Version | CUDA Version | cuDNN Version |
|---|---|---|---|
| 15.0 | 6 | 0 | 6.5 |
| 10.0 | 6 | 2 | 1 |
Steps for GPU Installation (Example for TF 1.15.0):
- Install NVIDIA Drivers: Make sure you have the latest drivers for your GPU.
- Install CUDA Toolkit: Download and install the correct version (e.g., CUDA 10.0) from the NVIDIA CUDA Toolkit Archive.
- Install cuDNN: Download the correct version (e.g., cuDNN 7.6.5 for CUDA 10.0) from the NVIDIA cuDNN Archive. You will need to create a free NVIDIA Developer account. Follow the instructions to copy the
include,lib, andbinfolders from the downloaded package into your CUDA toolkit directory. - Install TensorFlow-gpu:
# Inside your activated virtual environment pip install tensorflow-gpu==1.15.0
Option C: Build from Source (For Experts)
This is a complex process and is only necessary if you need a custom build (e.g., for a specific hardware optimization not available in the binary). It requires a C++ compiler and all development libraries.
# You will need the Bazel build system # Install Bazel (version must be compatible with TF version) # Example for TF 1.15.0: Bazel 0.26.1 # Clone the TensorFlow repository git clone https://github.com/tensorflow/tensorflow.git cd tensorflow # Checkout the specific version tag git checkout v1.15.0 # Configure the build ./configure # Build the pip package bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package # Install the generated wheel file # Find the .whl file in the bazel-bin directory and install it pip install /path/to/your/bazel-bin/tensorflow/tools/pip_package/build_pip_package.whl
Verification
After installation, you can verify that it's working correctly.
For a CPU-only installation:
import tensorflow as tf
# Print the version
print("TensorFlow Version:", tf.__version__)
# Create a simple constant and run a session (TF 1.x style)
# This is the standard way to run code in TF 1.x
a = tf.constant(10)
b = tf.constant(32)
c = a + b
print("TensorFlow is installed and working!")
print("Running a simple addition...")
# In TF 1.x, you need to create a session to run operations
with tf.Session() as sess:
result = sess.run(c)
print(f"Result of {a} + {b} = {result}")
For a GPU installation:
Run the same script, but add this check to see if TensorFlow is detecting your GPU.
import tensorflow as tf
print("TensorFlow Version:", tf.__version__)
# List available devices
from tensorflow.python.client import device_lib
print("Available Devices:")
print(device_lib.list_local_devices())
# Check if a GPU is available
if tf.test.is_gpu_available():
print("\nGPU is available and TensorFlow is using it.")
# A more detailed check for CUDA devices
gpu_devices = [x.name for x in device_lib.list_local_devices() if x.device_type == 'GPU']
print("GPU Devices:", gpu_devices)
else:
print("\nNo GPU detected. TensorFlow is running on CPU.")
Key Differences and Best Practices (TF 1.x vs. TF 2.x)
If you are on Python 3.6 and have installed TF 2.x, be aware of the major paradigm shift.
| Feature | TensorFlow 1.x (e.g., 1.15.0) | TensorFlow 2.x (e.g., 2.10.0) |
|---|---|---|
| Execution Model | Eager Execution is opt-in. Code is defined in a "Graph" and run inside a tf.Session(). |
Eager Execution is enabled by default. Code runs immediately, like standard Python. |
| High-Level API | tf.contrib.learn or tf.layers are common. |
Keras is integrated and the official high-level API. (tf.keras) |
| Model Definition | Use tf.placeholder for inputs and tf.Variable for weights. |
Use tf.keras.Input and tf.keras.layers or subclass tf.keras.Model. |
| Training Loop | Manually create sessions, run optimizers, and fetch loss values. | Use the model.compile() and model.fit() methods, or write a custom tf.function-decorated loop. |
| Code Migration | N/A | Use the tf_upgrade_v2 tool to automatically convert 1.x code to 2.x, but manual review is always required. |
Recommendation for Python 3.6: If you are starting a new project, it is highly recommended to upgrade your Python version (to 3.8+ is ideal) and use the latest stable version of TensorFlow 2.x. You will get a much better developer experience, better performance, and continued security support. Only stay on Python 3.6 / TF 1.x if you are maintaining an existing legacy system.
