Install the cpu version of tensorflow and pytorch
1. Check the computer graphics card
Check whether your computer has a discrete graphics card and what type of graphics card it has.
Control Panel → Device Manager → Display Adapter →
Because it is an integrated graphics card and there is no independent graphics card, the GPU version of tensorflow and pytorch cannot be installed. (The gpu version of tensorflow needs to install cuda and cudnn, but the cpu version does not need to be installed)
2. Install anaconda and pycharm
Go to the official website to download the installation package corresponding to your computer.
-
anaconda official website: https://www.anaconda.com/products/distribution#macos
Installation notes:
-
For pycharm installation,
you can find it randomly on the webpage and download the software. There should be an official website.
Note: Just check everything that can be checked.
3. Create the corresponding virtual environment
Avoid polluting the native environment and create a corresponding virtual environment
- Open anaconda and create a virtual environment
4.Install pytorch
-
Open the corresponding virtual environment.
Click the green triangle next to the created virtual environment to open the virtual environment.
-
Copy the mirror source to speed up downloads
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/conda config --set show_channel_urls yes
- Prevent downloading from being disconnected if it takes too long, with a delay of 1000s
conda config --set remote_read_timeout_secs 1000.0
Preparations completed
- To download and install the CPU version of torch
go to the pytorch official website. Get the download code
official website: https://pytorch.org/get-started/locally/
My computer installation is as follows:
conda install pytorch torchvision torchaudio cpuonly -c pytorch
Screenshot below
Download completed
- Check whether the torch installation is successful
pip list
5.Install tensorflow
-
Open the corresponding virtual environment
-
Add image source to install tensorflow
pip install tensorflow-cpu -i https://pypi.tuna.tsinghua.edu.cn/simple/
- Check whether the installation is successful
pip list