简体   繁体   中英

python, anaconda, Spyder -- uninstalling python package using pip DOES NOT work in Spyder + ipython

By using pip, I can successfully install new packages in ipython running in the Spyder environment. All I need to run is this:

!python -m pip install mypackage

However, trying to uninstall packages doesn't seem to work, at all. When I run:

!python -m pip uninstall mypackage

The console goes into a state of hanging. It's not strictly 'hanging' because neither Spyder nor the console hangs but the command just isn't returning anything

I am attaching a screenshot to help explain what I mean. The screenshot shows what happens AFTER I have pressed ENTER on this line - and nothing happens!

Does anything know why?

点卸载.jpg

You should not use pip with Spyder. It can break your whole distribution. Spyder is part of the Anaconda package and you should use the conda command instead of pip. The conda command works similar to the pip command. Instead of pip install package you'd use conda install package.

( Spyder maintainer here ) Both pip and conda are not meant to be run inside one of our IPython consoles because they expect to be running in a real system terminal (xterm, Terminal.app or cmd.exe).

In this case, pip expects input from the user (the confirmation that he/she really wants to uninstall a package). That confirmation can't be displayed in our consoles and it makes it looked like its blocked.

What you could do is to pass the -q option to pip to avoid confirmation. But in general it's a very bad idea to use pip and conda inside our consoles for the reasons I stated above.

I have a windows 10 64 bit machine, i installed spyder with pip and it could not work. so to uninstall i just used this command

pip uninstall spyder

however, if spyder has been installed with alongside Anaconda, Uninstalling Anacanda will delete its all packages including spyder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM