|

|  How to install TensorFlow on Linux?

How to install TensorFlow on Linux?

November 19, 2024

Learn how to seamlessly install TensorFlow on Linux in this step-by-step guide, ensuring a smooth setup for your machine learning projects.

How to install TensorFlow on Linux?

 

Install System Dependencies

 

  • Ensure that Python 3.6 to 3.10 is installed on your system. TensorFlow does not support earlier Python versions.
  •  

  • Upgrade pip to the latest version to avoid any compatibility issues:
    pip install --upgrade pip
    
  •  

  • Install virtualenv to create isolated Python environments:
    pip install virtualenv
    

 

Create a Virtual Environment

 

  • Create a directory for your TensorFlow environment. Enter the directory and set up the virtual environment:
    mkdir tensorflow_env
    cd tensorflow_env
    virtualenv .venv
    
  •  

  • Activate your virtual environment to ensure that your TensorFlow installation doesn't interfere with other projects:
    source .venv/bin/activate
    

 

Install TensorFlow

 

  • With the virtual environment activated, install TensorFlow. You can choose between CPU and GPU support:

       

    • For CPU support only:
      pip install tensorflow
      
    •  

    • For GPU support, ensure your NVIDIA drivers are updated, and install the GPU version:
      pip install tensorflow-gpu
      
  •  

  • Confirm that TensorFlow has been installed by starting a Python shell and importing TensorFlow:
    python
    >>> import tensorflow as tf
    >>> print(tf.__version__)
    

 

Set Up GPU Support

 

  • If you installed the GPU version, ensure that CUDA and cuDNN are correctly installed on your system. Visit the official NVIDIA documentation for the installation process.
  •  

  • Install the NVIDIA CUDA Toolkit and cuDNN with matching versions supported by TensorFlow. Consider setting environment variables to point to these installations:
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
    export CUDA_HOME=/usr/local/cuda
    

 

Test Your Installation

 

  • Check if TensorFlow can access the GPU:
    python -c "import tensorflow as tf; print('GPU', 'available' if tf.config.list_physical_devices('GPU') else 'not available')"
    
  •  

  • Run a simple TensorFlow script to test both installation and functionality:
    python -c "import tensorflow as tf; mnist = tf.keras.datasets.mnist; (x_train, y_train), (x_test, y_test) = mnist.load_data(); print('Training data shape:', x_train.shape)"
    

 

Maintain Your TensorFlow Environment

 

  • Keep TensorFlow updated to benefit from the latest features and patches. This is particularly important for staying compatible with CUDA and cuDNN updates.
    pip install --upgrade tensorflow
    
  •  

  • Use version control for your virtual environment's `requirements.txt` file to document the TensorFlow version and other dependencies:
    pip freeze > requirements.txt
    

 

Pre-order Friend AI Necklace

Pre-Order Friend Dev Kit

Open-source AI wearable
Build using the power of recall

Order Now

OMI AI PLATFORM
Remember Every Moment,
Talk to AI and Get Feedback

Omi Necklace

The #1 Open Source AI necklace: Experiment with how you capture and manage conversations.

Build and test with your own Omi Dev Kit 2.

Omi App

Fully Open-Source AI wearable app: build and use reminders, meeting summaries, task suggestions and more. All in one simple app.

Github →

Join the #1 open-source AI wearable community

Build faster and better with 3900+ community members on Omi Discord

Participate in hackathons to expand the Omi platform and win prizes

Participate in hackathons to expand the Omi platform and win prizes

Get cash bounties, free Omi devices and priority access by taking part in community activities

Join our Discord → 

OMI NECKLACE + OMI APP
First & only open-source AI wearable platform

a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded
a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded
online meeting with AI Wearable, showcasing how it works and helps online meeting with AI Wearable, showcasing how it works and helps
online meeting with AI Wearable, showcasing how it works and helps online meeting with AI Wearable, showcasing how it works and helps
App for Friend AI Necklace, showing notes and topics AI Necklace recorded App for Friend AI Necklace, showing notes and topics AI Necklace recorded
App for Friend AI Necklace, showing notes and topics AI Necklace recorded App for Friend AI Necklace, showing notes and topics AI Necklace recorded

OMI NECKLACE: DEV KIT
Order your Omi Dev Kit 2 now and create your use cases

Omi 開発キット 2

無限のカスタマイズ

OMI 開発キット 2

$69.99

Omi AIネックレスで会話を音声化、文字起こし、要約。アクションリストやパーソナライズされたフィードバックを提供し、あなたの第二の脳となって考えや感情を語り合います。iOSとAndroidでご利用いただけます。

  • リアルタイムの会話の書き起こしと処理。
  • 行動項目、要約、思い出
  • Omi ペルソナと会話を活用できる何千ものコミュニティ アプリ

もっと詳しく知る

Omi Dev Kit 2: 新しいレベルのビルド

主な仕様

OMI 開発キット

OMI 開発キット 2

マイクロフォン

はい

はい

バッテリー

4日間(250mAH)

2日間(250mAH)

オンボードメモリ(携帯電話なしで動作)

いいえ

はい

スピーカー

いいえ

はい

プログラム可能なボタン

いいえ

はい

配送予定日

-

1週間

人々が言うこと

「記憶を助ける、

コミュニケーション

ビジネス/人生のパートナーと、

アイデアを捉え、解決する

聴覚チャレンジ」

ネイサン・サッズ

「このデバイスがあればいいのに

去年の夏

記録する

「会話」

クリスY.

「ADHDを治して

私を助けてくれた

整頓された。"

デビッド・ナイ

OMIネックレス:開発キット
脳を次のレベルへ

最新ニュース
フォローして最新情報をいち早く入手しましょう

最新ニュース
フォローして最新情報をいち早く入手しましょう

thought to action.

Based Hardware Inc.
81 Lafayette St, San Francisco, CA 94103
team@basedhardware.com / help@omi.me

Company

Careers

Invest

Privacy

Events

Manifesto

Compliance

Products

Omi

Wrist Band

Omi Apps

omi Dev Kit

omiGPT

Personas

Omi Glass

Resources

Apps

Bounties

Affiliate

Docs

GitHub

Help Center

Feedback

Enterprise

Ambassadors

Resellers

© 2025 Based Hardware. All rights reserved.