How to uninstall package in Anaconda installed with pip

后端 未结 3 497
醉酒成梦
醉酒成梦 2021-02-02 12:17

The problem:

I have installed Anaconda:

conda -V
conda 4.4.7

Also I installed a lot of packages for it using pyt

相关标签:
3条回答
  • 2021-02-02 12:54

    One has to be careful when using pip inside a conda environment, whether for installing and unistalling packages. What works for me is based on https://stackoverflow.com/a/43729857/1047213.

    1. Install pip that is specific to the conda environment by running conda install pip inside the conda environment.
    2. Specify the entire path of that specific pip while installing or uninstalling a package. Usually, you will find it inside the bin folder of the virtual environment (e.g., /anaconda/envs/venv_name/bin/). Thus, the following works for me: /anaconda/envs/venv_name/bin/pip install_or_uninstall package_name.
    0 讨论(0)
  • 2021-02-02 12:59

    If you installed the package using setup.py, then you will most likely have to delete the package files manually.

    You'd find the Uninstalling setup.py install wiki useful. Unix instructions quoted below:

    sudo python setup.py install --record files.txt
    # inspect files.txt to make sure it looks ok. Then in bash:
    tr '\n' '\0' < files.txt | xargs -0 sudo rm -f --
    
    0 讨论(0)
  • 2021-02-02 13:09

    You can use Jupyter Notebook to solve this problem :

    • open Jupyter Notebook
    • open a new notebook with the right kernel
    • type !pip uninstall -y [package] in a code cell
    • run the cell code
    0 讨论(0)
提交回复
热议问题