Conda virtual environment configuration, Keras installation and Pycharm loading Conda virtual Windows environment

As a hapless old, you should be able to step on the pit have stepped all over. .

First, install Anaconda

1. Download Anaconda from the official website

https://www.anaconda.com/download/

2. Install

Such an interface will appear when installing (picture from the network)
Here Insert Picture Description
The first configured environment variables, check the system will prompt you to check this is not recommended, uncheck the installation is finished, you need to manually configure the environment variables.
(I believe the evil system ...)

3. Set Environment Variables

Under System Variables directory, find the [Path] option, click [New], the "X: \ Anaconda \ Scripts" to copy the past. (X is selected when you install disk)
Here Insert Picture Description

4. Test whether the installation is successful

At the command line, type "conda --version" command returns the version number, then the installation was successful.
Here Insert Picture Description

Second, create a virtual environment

1.

The implementation of "conda create -n keras_env Python = 3.6 " command to create a virtual environment
Here Insert Picture Description
error: CondaHTTPError: HTTP 000 CONNECTION FAILED for url.

2.

Hereinafter, after completion of the method according to the operation, still CondaHTTPError.
https://blog.csdn.net/Copper01/article/details/97134974

Tsinghua source image is removed and then restored, but it had no effect.
https://blog.csdn.net/dream_allday/article/details/80344511?utm_source=blogxgwz8

I read a lot of similar methods, after the operation still to no avail.

发现自己忽视了Anaconda可视化的管理工具:
Here Insert Picture Description
于是想打开试一试,操作界面
Here Insert Picture Description
具体建立虚拟环境不一一贴图了,需要注意的是,如果你是要装keras,Python版本要选择3.6。

3.

是的,我装了3.7,结果如下:
Here Insert Picture Description
在这个管理工具中仍然可以方便地把它回退到3.6版本:
在 Installed 的包中选择Python,在图中绿色选项中可选择要回退的版本。
Here Insert Picture Description

三、安装keras

在这里搜索keras就好。
Here Insert Picture Description

四、Pycharm中使用Conda虚拟环境

1.

在“文件”处新建“新项目”
Here Insert Picture Description

2.

点击“Add Local”找到"Anaconda"中创建的虚拟环境中的“python.exe”作为Interpreter(解释器)
Here Insert Picture Description

五、检查keras是否能够成功安装

1.打开命令行,输入“activate keras_env";
2.输入”python“;
3.输入”import keras“;

果不其然,又报错了。
当时没有截图,大致意思是keras和tensorflow版本不适配。

附上keras和tensorflow对应的版本,可自行查找。
https://docs.floydhub.com/guides/environments/

亲测后,似乎有几个仍然会报错,问题可能出在numpy的版本上。

最后运行成功的组合:
Keras 2.1.5 + Tensorflow 1.5.0 + numpy 1.13.1。

Released six original articles · won praise 3 · Views 173

Guess you like

Origin blog.csdn.net/qq_38803651/article/details/104698210