如何删除pipenv的PipFile,PipFile.lock和相关的virtualenv?

时间:2018-04-12 09:31:57

标签: python pipenv

要为python项目创建pipenv,我首先创建了一个项目文件夹并进入该文件夹,指示pipenv创建PipfilePipfile.lock并关联像这样的虚拟环境:

$ mkdir Project
$ cd Project
$ pipenv --three
Creating a virtualenv for this project…
Using /usr/bin/python3 (3.5.2) to create virtualenv…
⠋Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in ~/.local/share/virtualenvs/Projects-jrsJaPdI/bin/python3
Also creating executable in ~/.local/share/virtualenvs/Projects-jrsJaPdI/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: ~/.local/share/virtualenvs/Projects-jrsJaPdI
Creating a Pipfile for this project…
$
$ pipenv install --dev
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (711973)!
Installing dependencies from Pipfile.lock (711973)…
     ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
To activate this project's virtualenv, run the following:
 $ pipenv shell

当不在pipenv模式时,删除所有pipenv shell已创建的正确方法是否只是在Project目录中执行以下操作:

$ pipenv --rm
$ rm Pipfil*

意思是我必须首先删除Project文件夹的虚拟环境,然后再删除PipfilePipfile.lock

2 个答案:

答案 0 :(得分:1)

我们在这里:

# Removing venv directory ...
$ pipenv --rm

# ... and Pipfile, Pipfile.lock
$ rm Pipfile*

# Strange that deleted venv still activated, so exit from it.
$ exit

答案 1 :(得分:0)

是的,这些是删除pipenv工件的正确说明。

要完全撤消您在示例中显示的所有内容,您需要继续:

$ cd ..
$ rm -rf Project