查看本机python和pip的版本

python --version
pip --version

我这例python为3.6 pip为21

1创建虚拟环境

先自己找好一个盘,比如我选的E盘
控制台

e:
python -m venv --system-site-packages .\venv

激活虚拟环境

.\venv\Scripts\activate

更新

e:\venv\Scripts\python.exe -m pip install --upgrade pip

pip list  # show packages installed within the virtual environment

关闭虚拟环境

deactivate  # don't exit until you're done using TensorFlow

安装tf

Choose one of the following TensorFlow packages to install from PyPI:

tensorflow —Latest stable release with CPU and GPU support (Ubuntu and Windows).
tf-nightly —Preview build (unstable). Ubuntu and Windows include GPU support.
tensorflow==1.15 —The final version of TensorFlow 1.x.

pip install --upgrade tensorflow-gpu

或者

pip install --upgrade tensorflow-cpu
pip install tensorflow==1.15      # CPU
pip install tensorflow-gpu==1.15  # GPU

验证

python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

相关文章:

  • 2021-12-30
  • 2021-10-01
  • 2021-06-15
  • 2021-07-09
  • 2022-02-20
  • 2021-10-03
  • 2022-12-23
猜你喜欢
  • 2021-11-03
  • 2021-10-13
  • 2021-05-10
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
相关资源
相似解决方案