简体   繁体   English

如果环境目录不为空,为什么命令 'pipenv --rm' 不起作用? (视窗)

[英]Why does the command 'pipenv --rm' not work if the environment directory is not empty? (Windows)

I created a test virtual environment using pipenv install to practice with my new installation of pipenv.我使用pipenv install创建了一个测试虚拟环境来练习我新安装的 pipenv。 I went to remove the virtual environment using pipenv --rm and it gave the following output in the cmd prompt:我使用pipenv --rm删除了虚拟环境,它在 cmd 提示符中给出了以下 output :

D:\Desktop\testproject>pipenv --rm
Removing virtualenv (C:\Users\Harry\.virtualenvs\testproject-Ox2snZ7k)…
[=== ] Running...Error:  An error occurred while removing C:\Users\Harry\.virtualenvs\testproject-Ox2snZ7k!
[WinError 145] The directory is not empty: 'C:\\Users\\Harry\\.virtualenvs\\testproject-Ox2snZ7k'

It makes me wonder: what is the point of --rm if it means I have to manually remove the environment directory (eg testproject-Ox2snZ7k) myself?这让我想知道:如果这意味着我必须自己手动删除环境目录(例如 testproject-Ox2snZ7k),那么--rm有什么意义?

I tried pipenv --rm the next morning and the virtual environment was removed without an issue.第二天早上我尝试pipenv --rm并没有问题地删除了虚拟环境。 As @ivan_pozdeev commented, something in the environment was probably being used elsewhere.正如@ivan_pozdeev 评论的那样,环境中的某些东西可能正在其他地方使用。

I will update this answer with Procmon results if it happens again.如果再次发生,我将使用 Procmon 结果更新此答案。

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

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