pipenv install --ignore-pipfile 是不是和 pipenv install 没有任何区别? 因为 pipenv install = pipenv lock + pipenv sync, 所以无论有没有加--ignore-pipfile, 都会更新 Pipfile.lock 然后从 Pipfile.lock 安装. 如果想要真的忽略 Pipfile, 为什么不直接用 pipenv sync?
For example:
# Pipfile
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
"requests" = "==2.11.0"
[dev-packages]
[requires]
python_version = "3.12"
# Pipfile.lock
{
"_meta": {
"hash": {
"sha256": "7f1be087f2e6adbe8ec64f71bfaaed8b6bb1595f3769488039b14c9d2e555dca"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.12"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"requests": {
"hashes": [
"sha256:09bc1b5f3a56cd8c48d433213a8cba51a67d12936568f73b5f1793fcb0c0979e",
"sha256:63f1815788157130cee16a933b2ee184038e975f0017306d723ac326b5525b54"
],
"index": "pypi",
"markers": "python_version >= '3.8'",
"version": "==2.10.0"
}
},
"develop": {}
}
If I run pipenv install
:
$ pipenv install
Pipfile.lock (555dca) out of date: run `pipfile lock` to update to (14165b)...
Running $ pipenv lock then $ pipenv sync.
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Locking [dev-packages] dependencies...
Updated Pipfile.lock (793cf11c853344d4cc8f42ede41e771eb6afaccce2510f7daf1efb578d14165b)!
Installing dependencies from Pipfile.lock (14165b)...
All dependencies are now up-to-date!
Installing dependencies from Pipfile.lock (14165b)...
If I run pipenv install --ignore-pipfile
:
$ pipenv install --ignore-pipfile
Pipfile.lock (555dca) out of date: run `pipfile lock` to update to (14165b)...
Running $ pipenv lock then $ pipenv sync.
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Locking [dev-packages] dependencies...
Updated Pipfile.lock (793cf11c853344d4cc8f42ede41e771eb6afaccce2510f7daf1efb578d14165b)!
Installing dependencies from Pipfile.lock (14165b)...
All dependencies are now up-to-date!
Installing dependencies from Pipfile.lock (14165b)...
No difference at all.
If I run pipenv sync
:
$ pipenv sync
Installing dependencies from Pipfile.lock (555dca)...
All dependencies are now up-to-date!