How do I remove/delete a virtualenv?

前端 未结 16 988
感动是毒
感动是毒 2020-11-29 14:25

I created an environment with the following command: virtualenv venv --distribute

I cannot remove it with the following command: rmvirtualenv venv

相关标签:
16条回答
  • 2020-11-29 15:09

    If you are a Windows user and you are using conda to manage the environment in Anaconda prompt, you can do the following:

    Make sure you deactivate the virtual environment or restart Anaconda Prompt. Use the following command to remove virtual environment:

    $ conda env remove --name $MyEnvironmentName
    

    Alternatively, you can go to the

    C:\Users\USERNAME\AppData\Local\Continuum\anaconda3\envs\MYENVIRONMENTNAME
    

    (that's the default file path) and delete the folder manually.

    0 讨论(0)
  • 2020-11-29 15:13

    Just to echo what @skytreader had previously commented, rmvirtualenv is a command provided by virtualenvwrapper, not virtualenv. Maybe you didn't have virtualenvwrapper installed?

    See VirtualEnvWrapper Command Reference for more details.

    0 讨论(0)
  • 2020-11-29 15:13

    Simply remove the virtual environment from the system.There's no special command for it

    rm -rf venv
    
    0 讨论(0)
  • 2020-11-29 15:15

    You can follow these steps to remove all the files associated with virtualenv and then reinstall the virtualenv again and using it

    cd {python virtualenv folder}
    
    find {broken virtualenv}/ -type l                             ## to list out all the links
    
    deactivate                                           ## deactivate if virtualenv is active
    
    find {broken virtualenv}/ -type l -delete                    ## to delete the broken links
    
    virtualenv {broken virtualenv} --python=python3           ## recreate links to OS's python
    
    workon {broken virtualenv}                       ## activate & workon the fixed virtualenv
    
    pip3 install  ... {other packages required for the project}
    
    
    0 讨论(0)
提交回复
热议问题