简体   繁体   English

pip想要从其他虚拟环境中卸载站点包

[英]pip wants to uninstall site-packages from a different virtual environment

I'm working in a python virtual environment (with virtualenvwrapper ). 我在python虚拟环境中工作(使用virtualenvwrapper )。 I created a branch of my code and I wanted to edit it in a different virtualenv. 我创建了代码的一个分支,并想在另一个virtualenv中对其进行编辑。 I define the path to my django src folder (and a few more things) in the postactivate script. 我在postactivate脚本中定义django src文件夹的路径(还有其他一些内容)。

I did $ cpvirtualenv ~/.virtualenv/v1 ~/.virtualenv/v2 it was copied successfully. 我做了$ cpvirtualenv ~/.virtualenv/v1 ~/.virtualenv/v2它已成功复制。

I then workon v2 and wanted to pip uninstall PIL . 然后,我workon v2并希望通过pip uninstall PIL I get the following error: 我收到以下错误:

Not uninstalling PIL at /home/myuser/.virtualenv/v1/lib/python2.7/site-packages/PIL, outside environment /home/myuser/.virtualenv/v2

I also tried it from ~/.virtualenv/v2 我也从~/.virtualenv/v2尝试过

I don't want to uninstall PIL from v1, but from v2. 我不想从v1卸载PIL,而是从v2卸载。 I also tried virtualenv-clone and I don't get what's happening. 我还尝试了virtualenv-clone,但我不知道发生了什么。 I can always create a new virtualenv, copy the postactivate script and pip -r install requirements.txt but I'd like to understand the error I got. 我总是可以创建一个新的virtualenv,复制postactivate脚本和pip -r install requirements.txt但是我想了解我得到的错误。

Excerpt from the doc: 摘录自文档:

Copying virtual environments is not well supported. 复制虚拟环境不受很好的支持。 Each virtualenv has path information hard-coded into it, and there may be cases where the copy code does not know to update a particular file. 每个virtualenv都有硬编码的路径信息,在某些情况下,复制代码可能无法更新特定文件。 Use with caution. 请谨慎使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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