Install TensorFlow on WSL
1 Introduction
For the installation of WSL, you can refer to this article:
This article is installed in a virtual environment, and you may encounter some problems when installing in a system environment.
My ubuntu is 20.4, WSL2, Python 3.8.10
2. Configure the virtual environment
- Install the venv package:
sudo apt-get install python3-venv
- Create a new virtual environment
python3 -m venv --system-site-packages 自己的环境名字./venv
- activate the virtual environment
source 自己的环境名字./venv/bin/activate
When a virtual environment is active, the shell prompt is prefixed with (venv).
Install TensorFlow
First upgrade pip:
pip install --upgrade pip
Install TensorFlow
pip install --upgrade tensorflow
Verify the installation effect:
python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"