win10 Anaconda+tensorflow/pytorch installation

Anaconda installation

Official website download: https://www.anaconda.com/
insert image description here
insert image description here
All the way to next to complete the installation. Don't forget to add to environment variable: Download Path\Scripts

Tensorflow installation

Find Anaconda Prompt in the start and open it:
insert image description here
you can use conda --version to view the current version and check whether the installation is successful.
Next, enter the Tsinghua mirror (optional)
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
insert image description here
Create a virtual environment for tensorflow , I named it tensorflow1
conda create -n tensorflow1 python=3.9
insert image description here
Start the environment through conda activate tensorflow1
insert image description here
Next, install tensorflow and provide several methods seen on the Internet. If one fails, change another one:
1. Graphical in anaconda Install directly in the interface, find the previous virtual environment, search for tensorflow in the virtual environment and install it
2. Use the pip command to install on the command line interface just now:
pip install --upgrade --ignore-installed tensorflow
3. In the command just now The line interface uses the conda command to install:
conda install tensorflow
conda install ipython
conda install jupyter
4. Referencehttps://www.bilibili.com/video/BV1Ao4y197MT?from=search&seid=6529922356331161498
Generally speaking, it will be fine at this time. Test the following code:

(tensorflow) C:\Users\MI>python
 
>>> import tensorflow as tf
 
>>> hello = tf.constant('Hello, TensorFlow!')
 
>>> sess = tf.Session()
 
>>> print(sess.run(hello))
 
b'Hello, TensorFlow!'
 
>>> sess.close()

If you can output b'Hello, TensorFlow!', you are successful.

Finally, install jupyter in the virtual environment, open jupyter notebook, and write code in it.

In addition: You can modify the jupyterlab home directory according to the following blog.
https://www.cnblogs.com/luhuan/p/9054366.html

Add a line: conda install pytorch: https://pytorch.org/get-started/locally/

Guess you like

Origin blog.csdn.net/yzsjwd/article/details/113825749