Windows10下安装Anaconda并用vs

2019-08-28  本文已影响0人  Panda_chen

清华镜像下载对应版本


https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=M&O=D


下载Anaconda25.2.0(64bit)

TUNA 还提供了 Anaconda 仓库的镜像,运行以下命令:


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

当出现cmd 中conda命令报错的时候,需要添加系统环境变量

分号隔开,

D:\Anaconda;D:\Anaconda\Scripts

进入cmd


进入cmd

输入conda--version 查看anconda版本

conda create -n tensorflow pip python=3.5

activate tensorflow

修改源提高下载速度

设置国内镜像

清华TUNA镜像源有Anaconda仓库的镜像,我们将其加入conda的配置即可:

# 添加Anaconda的TUNA镜像

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/# TUNA的help中镜像地址加有引号,需要去掉

# 设置搜索时显示通道地址

conda config --set show_channel_urls yes

执行完上述命令后,会生成~/.condarc(Linux/Mac)或C:UsersUSER_NAME.condarc文件,记录着我们对conda的配置,直接手动创建、编辑该文件是相同的效果。

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --set show_channel_urls yes

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/

pip install --ignore-installed --upgrade tensorflow

激活tensorflow环境 activate tensorflow 验证是否安装完成

 import tensorflow as tf

hello = tf.constant('Hello, TensorFlow!')

sess = tf.Session()

print(sess.run(hello))

VS中加载tensorflow

// 将设置放入此文件中以覆盖默认设置

{

    "python.pythonPath": "D:\\Anaconda3\\envs\\tensorflow\\python.exe",

    "python.autoComplete.extraPaths": [

        "D:\\Anaconda3\\envs\\tensorflow",

        "D:\\Anaconda3\\envs\\tensorflow\\Lib\\site-packages"

    ],

    "workbench.statusBar.visible": true,

    "files.autoGuessEncoding": true,

    "python.autoComplete.addBrackets": true,

    "python.autoComplete.preloadModules": [

        "tensorflow"

    ],

    "python.linting.pep8Enabled": true

}

pylint

pep8

如果出现AVX AVX2报错

在代码前输入

import os

os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

上一篇 下一篇

猜你喜欢

热点阅读