Python 如何卸载 Keras?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41414489/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 00:54:50  来源:igfitidea点击:

How to uninstall Keras?

pythontheanokeras

提问by Eka

I have installed Keras using this command:

我已经使用以下命令安装了 Keras:

sudo pip install keras

It installed properly and worked fine until I tried to import application modules:

它安装正确并且运行良好,直到我尝试导入应用程序模块:

from keras.applications.vgg16 import VGG16
Using Theano backend.
Couldn't import dot_parser, loading of dot files will not be possible.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named applications.vgg16

I came across this link which recommendsto uninstall Keras and directly install Keras from GitHub:

我遇到了这个链接,它建议卸载 Keras 并直接从 GitHub 安装 Keras:

sudo pip install git+https://github.com/fchollet/keras.git

Before reinstalling Keras from GitHub, I tried to unistall Keras using this command but it throws this error:

在从 GitHub 重新安装 Keras 之前,我尝试使用此命令卸载 Keras,但它抛出此错误:

sudo pip uninstall keras
Can't uninstall 'Keras'. No files were found to uninstall.

回答by Md. Rezwanul Haque

You can simply try from the following command:

您可以简单地从以下命令尝试:

pip uninstall keras

回答by Eka

I followed this methodto solve my problem

我按照这个方法解决了我的问题

>> import keras
>> keras.__path__
['/usr/local/lib/python2.7/dist-packages/keras']

#copy the path
>> sudo  rm -r /usr/local/lib/python2.7/dist-packages/keras

#re installation
>> sudo pip install git+https://github.com/fchollet/keras.git

回答by m0z4rt

uninstall keras:

卸载keras:

pip uninstall keras -y                                                                                                                                                                            

reinstall with specific version

使用特定版本重新安装

pip install -Iv keras==2.1.4 

回答by icoxfog417

I think you really want to do is not to uninstall the keras, but use the keras.applications.vgg16.
The following checklist will help you to clarify the issue.

我想你真正想做的不是卸载 keras,而是使用keras.applications.vgg16.
以下清单将帮助您澄清问题。

  • Keras version: confirm the version of the keras is latest (now 2.0.5)
  • Backend: Theano/Tensorflow or the other
  • Device: GPU or CPU
  • Python version: 2 or 3 and use Anaconda or not
  • Operating system: Mac, Windows, Linux, and so on
  • Keras 版本:确认 keras 的版本是最新的(现在是 2.0.5)
  • 后端:Theano/Tensorflow 或其他
  • 设备:GPU 或 CPU
  • Python 版本:2 或 3,是否使用 Anaconda
  • 操作系统:Mac、Windows、Linux等

I recommend to check latest keras, TensorFlow backend(CPU mode), Python3setting at first. It will solve various problems.

我建议首先检查最新的 keras、TensorFlow 后端(CPU 模式)、Python3设置。它将解决各种问题。

回答by Van

You can simply do that with sudo pip -U install keras

你可以简单地做到这一点 sudo pip -U install keras

回答by Yanfeng Liu

Please also check the Anaconda environment if you are using any

如果您正在使用任何环境,请同时检查 Anaconda 环境

回答by PAWAN LAKHOTIA

In Anaconda prompt type

在 Anaconda 提示类型中

conda uninstall keras

回答by Thett Oo Eain

you can uninstall from conda by using this command. conda uninstall keras

您可以使用此命令从 conda 卸载。 conda uninstall keras

回答by Nicola Landro

Try this:

尝试这个:

sudo pip uninstall git+https://github.com/fchollet/keras.git

If that does not work, what you can see after sudo pip list?

如果这不起作用,您可以看到sudo pip list什么?

回答by Anshuman Kumar

NOTE: Since this edit was rejected for Eka's answer,which worked for me, I added this as answer for folks who have to use Windows.

注意:由于 Eka 的回答拒绝了此编辑,这对我有用,因此我将其添加为必须使用 Windows 的人的答案。

import keras
print(keras.__path__)
C:\Users\oyo\Anaconda3\envs\py36\lib\site-packages\keras

Now in Command Prompt

现在在命令提示符中

cd C:\Users\oyo\Anaconda3\envs\py36\lib\site-packages\

rmdir keras