要为 python 项目创建 pipenv
,我首先创建了一个项目文件夹并进入该文件夹以指示 pipenv
创建 Pipfile
、 Pipfile.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 文件夹的虚拟环境,然后再删除
Pipfile
和 Pipfile.lock
? 最佳答案
我们到了:
# Removing venv directory ...
$ pipenv --rm
# ... and Pipfile, Pipfile.lock
$ rm Pipfile*
# Strange that deleted venv still activated, so exit from it.
$ exit