当前位置:网站首页>Anaconda related knowledge supplement (spyder+keras Library)

Anaconda related knowledge supplement (spyder+keras Library)

2022-06-11 08:12:00 Xiongkairui

Spyder+Keras library

Before, after Anaconda Repeated reinstallation of software , uninstall , I have a deeper understanding of this software and related libraries .
If not downloaded Anaconda or tensorflow
Take a look at this article :Anaconda+tensorflow The most effective summary version
Download it , You can see the following content directly

1、Anaconda You can create multiple virtual environments , In this virtual environment , We can download the libraries and software we need , such as Spyder Software , If you want to work in different versions python+tensorflow Operating under the environment of Spyder, Then we have to download it Spyder, Finally, we can get different environment Spyder.
As shown below :
 Insert picture description here
In the picture above , There are two Spyder, One is in base Downloaded under the environment Spyder(Anaconda3), There is also an environment created by myself (python3.7) In the installation of Spyder(python37)

That is, if you want to run in your own environment Spyder, Then you have to activate your own environment first , First use Administrator status function Anaconda Prompt window .

activate python37     

Then execute the following command .

pip install spyder

That's all right. ,( Premise is : Yours Anaconda Installation successful )

2、 When you download the virtual environment Spyder After software , You open it deliberately Spyder, Start using it . But when you run the relevant code , Some libraries may be missing , You have to install it yourself , Installing these libraries is simple , Similar to the above command , The virtual environment is activated first , Then execute the following command .

pip install + Missing database name 

Let me give you an example
Keras As Tensorflow Encapsulated interfaces API, suffer Tensorflow The impact of version changes , So when you're Spyder The following error is reported in the result of running the code in the software :

ModuleNotFoundError: No module named 'keras'

Most likely not downloaded keras This library
If you run the following command directly :

pip install keras

It can be installed successfully , But there will still be errors when running .

This is most likely because tensorflow and keras Of Version mismatch .
Here's the picture , This is a tensorflow and keras Matching table for .
 Insert picture description here

 Insert picture description here
 Insert picture description here
According to the corresponding situation above , Download reasonably keras Library will do .
Last , It can be used normally .

原网站

版权声明
本文为[Xiongkairui]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020514191523.html