pipenv 包安装失败 (ModuleNotFoundError)

pipenv failed package installation (ModuleNotFoundError)

我正在使用 pipenv 进行依赖管理。我正在尝试为我当前的项目安装 numpy、pyzmq 和 msgpack。我的Pipfile是这样写的:

[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[packages]
numpy = "*"
pyzmq = "*"
msgpack = "*"

[dev-packages]
pylint = "*"

[requires]
python_version = "3.7"

然而当我运行命令pipenv install时,它给出了以下错误:

Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success! 
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success! 
Updated Pipfile.lock (b6163d)!
Installing dependencies from Pipfile.lock (b6163d)...
An error occurred while installing msgpack==1.0.2 --hash=sha256:b6d9e2dae081aa35c44af9c4298de4ee72991305503442a5c74656d82b581fe9 --hash=sha256:e89ec55871ed5473a041c0495b7b4e6099f6263438e0bd04ccd8418f92d5d7f2 --hash=sha256:0cb94ee48675a45d3b86e61d13c1e6f1696f0183f0715544976356ff86f741d9 --hash=sha256:b28c0876cce1466d7c2195d7658cf50e4730667196e2f1355c4209444717ee06 --hash=sha256:9ea52fff0473f9f3000987f313310208c879493491ef3ccf66268eff8d5a0326 --hash=sha256:d6c64601af8f3893d17ec233237030e3110f11b8a962cb66720bf70c0141aa54 --hash=sha256:92be4b12de4806d3c36810b0fe2aeedd8d493db39e2eb90742b9c09299eb5759 --hash=sha256:87869ba567fe371c4555d2e11e4948778ab6b59d6cc9d8460d543e4cfbbddd1c --hash=sha256:de6bd7990a2c2dabe926b7e62a92886ccbf809425c347ae7de277067f97c2887 --hash=sha256:8ffb24a3b7518e843cd83538cf859e026d24ec41ac5721c18ed0c55101f9775b --hash=sha256:f484cd2dca68502de3704f056fa9b318c94b1539ed17a4c784266df5d6978c87 --hash=sha256:497d2c12426adcd27ab83144057a705efb6acc7e85957a51d43cdcf7f258900f --hash=sha256:8521e5be9e3b93d4d5e07cb80b7e32353264d143c1f072309e1863174c6aadb1 --hash=sha256:e36a812ef4705a291cdb4a2fd352f013134f26c6ff63477f20235138d1d21009 --hash=sha256:d8167b84af26654c1124857d71650404336f4eb5cc06900667a493fc619ddd9f --hash=sha256:f3e6aaf217ac1c7ce1563cf52a2f4f5d5b1f64e8729d794165db71da57257f0c --hash=sha256:b55f7db883530b74c857e50e149126b91bb75d35c08b28db12dcb0346f15e46e --hash=sha256:26a1759f1a88df5f1d0b393eb582ec022326994e311ba9c5818adc5374736439 --hash=sha256:1026dcc10537d27dd2d26c327e552f05ce148977e9d7b9f1718748281b38c841 --hash=sha256:ac25f3e0513f6673e8b405c3a80500eb7be1cf8f57584be524c4fa78fe8e0c83 --hash=sha256:a99b144475230982aee16b3d249170f1cccebf27fb0a08e9f603b69637a62192 --hash=sha256:a4355d2193106c7aa77c98fc955252a737d8550320ecdb2e9ac701e15e2943bc --hash=sha256:fae04496f5bc150eefad4e9571d1a76c55d021325dcd484ce45065ebbdd00984 --hash=sha256:c747c0cc08bd6d72a586310bda6ea72eeb28e7505990f342552315b229a19b33 --hash=sha256:5a9ee2540c78659a1dd0b110f73773533ee3108d4e1219b5a15a8d635b7aca0e --hash=sha256:2a5866bdc88d77f6e1370f82f2371c9bc6fc92fe898fa2dec0c5d4f5435a2694 --hash=sha256:31c17bbf2ae5e29e48d794c693b7ca7a0c73bd4280976d408c53df421e838d2a --hash=sha256:fe07bc6735d08e492a327f496b7850e98cb4d112c56df69b0c844dbebcbb47f6! Will try again.
An error occurred while installing numpy==1.19.5 --hash=sha256:2e55195bc1c6b705bfd8ad6f288b38b11b1af32f3c8289d6c50d47f950c12e76 --hash=sha256:cc6bd4fd593cb261332568485e20a0712883cf631f6f5e8e86a52caa8b2b50ff --hash=sha256:dbd18bcf4889b720ba13a27ec2f2aac1981bd41203b3a3b27ba7a33f88ae4827 --hash=sha256:603aa0706be710eea8884af807b1b3bc9fb2e49b9f4da439e76000f3b3c6ff0f --hash=sha256:759e4095edc3c1b3ac031f34d9459fa781777a93ccc633a472a5468587a190ff --hash=sha256:400580cbd3cff6ffa6293df2278c75aef2d58d8d93d3c5614cd67981dae68ceb --hash=sha256:6149a185cece5ee78d1d196938b2a8f9d09f5a5ebfbba66969302a778d5ddd1d --hash=sha256:012426a41bc9ab63bb158635aecccc7610e3eff5d31d1eb43bc099debc979d94 --hash=sha256:0eef32ca3132a48e43f6a0f5a82cb508f22ce5a3d6f67a8329c81c8e226d3f6e --hash=sha256:a4646724fba402aa7504cd48b4b50e783296b5e10a524c7a6da62e4a8ac9698d --hash=sha256:d6631f2e867676b13026e2846180e2c13c1e11289d67da08d71cacb2cd93d4aa --hash=sha256:cae865b1cae1ec2663d8ea56ef6ff185bad091a5e33ebbadd98de2cfa3fa668f --hash=sha256:36674959eed6957e61f11c912f71e78857a8d0604171dfd9ce9ad5cbf41c511c --hash=sha256:06fab248a088e439402141ea04f0fffb203723148f6ee791e9c75b3e9e82f080 --hash=sha256:aeb9ed923be74e659984e321f609b9ba54a48354bfd168d21a2b072ed1e833ea --hash=sha256:50a4a0ad0111cc1b71fa32dedd05fa239f7fb5a43a40663269bb5dc7877cfd28 --hash=sha256:7fb43004bce0ca31d8f13a6eb5e943fa73371381e53f7074ed21a4cb786c32f8 --hash=sha256:1ded4fce9cfaaf24e7a0ab51b7a87be9038ea1ace7f34b841fe3b6894c721d1c --hash=sha256:39b70c19ec771805081578cc936bbe95336798b7edf4732ed102e7a43ec5c07a --hash=sha256:ab83f24d5c52d60dbc8cd0528759532736b56db58adaa7b5f1f76ad551416a1e --hash=sha256:cf2402002d3d9f91c8b01e66fbb436a4ed01c6498fffed0e4c7566da1d40ee1e --hash=sha256:99abf4f353c3d1a0c7a5f27699482c987cf663b1eac20db59b8c7b061eabd7fc --hash=sha256:df609c82f18c5b9f6cb97271f03315ff0dbe481a2a02e56aeb1b1a985ce38e60 --hash=sha256:a12ff4c8ddfee61f90a1633a4c4afd3f7bcb32b11c52026c92a12e1325922d0d --hash=sha256:a76f502430dd98d7546e1ea2250a7360c065a5fdea52b2dffe8ae7180909b6f4 --hash=sha256:8b5e972b43c8fc27d56550b4120fe6257fdc15f9301914380b27f74856299fea --hash=sha256:43d4c81d5ffdff6bae58d66a3cd7f54a7acd9a0e7b18d97abb255defc09e3140 --hash=sha256:a9d17f2be3b427fbb2bce61e596cf555d6f8a56c222bd2ca148baeeb5e5c783c --hash=sha256:c843b3f50d1ab7361ca4f0b3639bf691569493a56808a0b0c54a051d260b7dbd --hash=sha256:d051ec1c64b85ecc69531e1137bb9751c6830772ee5c1c426dbcfe98ef5788d7 --hash=sha256:2ea52bd92ab9f768cc64a4c3ef8f4b2580a17af0a5436f6126b08efbd1838371 --hash=sha256:384ec0463d1c2671170901994aeb6dce126de0a95ccc3976c43b0038a37329c2 --hash=sha256:811daee36a58dc79cf3d8bdd4a490e4277d0e4b7d103a001a4e73ddb48e7e6aa --hash=sha256:a0d53e51a6cb6f0d9082decb7a4cb6dfb33055308c4c44f53103c073f649af73! Will try again.
An error occurred while installing pyzmq==21.0.1 --hash=sha256:77371c7a39d2f1b71444128b9377be8b0588c3fbf7f56db970c5d4b7af8ed9fd --hash=sha256:f321b1e2ea990e9e760c1894234ee426e150995691c05b840a0d9743f5f202e1 --hash=sha256:e98d9b9efb22ece82b06046ba0c00cce157cbfd852cbd9a385b338f295cf38e6 --hash=sha256:923ec92c7b82d63bab4193aee23fd4a2b1636369494d55883fbda10fef1075a3 --hash=sha256:e51ea97103791597e4deca13992c3544224c7eed89dc575d9a85972b16f01b59 --hash=sha256:083dd4c1e9bc058acabab5d95e25180cec224ca9d372b088bf204b0822b278a9 --hash=sha256:a2b9e25ea0f81e920de3bff65a5bd9056acd81f8cb439546d00d77f386cba251 --hash=sha256:69e5c1061a2e99ac2647db271a41cb5c95ff62dd5090a948b1fbca905c5cba81 --hash=sha256:c12fba29f0b956390aed37d463fbea215d7592c08241fb20a2c165ef64c95019 --hash=sha256:405e754799480d960df7d8249192c4e46288d41d08aaaa45f339269bc09f3c0a --hash=sha256:7ca684fdb433577c30243357813eef81973d5dbbc3c6c1568e6c21ec1dcedda3 --hash=sha256:9026acf8bf0852c8360c574d04d22d7a213dafaf04ab9c4d43c7430eda272cdd --hash=sha256:8f17f71430c18666c0f6c81185ef494f59231d01b1f77f67debfe628d50479c6 --hash=sha256:7ea55c672840ee8fd5884134c0697845d28f5b053713fc682b5d5fc73d747853 --hash=sha256:5adc4e3015c647e413bdcf3cac803ffdb8566b938f83e5234ab9c2c14fe3ea3a --hash=sha256:c3a630dd7716e8e127d43b22598e256a2d11a847b8cc3310350528960037fa06 --hash=sha256:76e1b4dff2be48ed98ec34dd10ad97316e69cb5ff37754f84abc9fb4bbc949bc --hash=sha256:b1fb293a5562a4870f20bb859a50bd59c14fdb1fc13353e25267facaf68f6eb0 --hash=sha256:a82f6f41523db5408925b82bb150ecbc625c2eeccf31d38fa1a0e395e11dd5e2 --hash=sha256:20c53aff015001cb705db0928850fa74ea4280a935d4e726743e4cb13206b0f2 --hash=sha256:f1e357e234b435441b9366f6958623abe74fbbb1bd8e3bc679f09b5126785785 --hash=sha256:b2a5d5fd2857e5006a5fd9067f5aa7aff0cd4f994180681b13a6bd724a5ce289 --hash=sha256:de00a0fe9735efa06b96af56c8e7baa67c0972ec510e18c98efbb593c73cd886 --hash=sha256:fe0186c70fd3205b31daaa024409b8887af9b0344f47bc4d5ed03f08f64b9552 --hash=sha256:01715453ce14d4b804f87969461d21fff47df9bebde3c283c1ad872207717abc --hash=sha256:2199156013875ff4f872daa86214fe34658e4017b5cd8c4a2c4d6d9b59d1a2eb --hash=sha256:520a80148c26cfbfb76fd169c089e7a899071dd5cd7553269e4da149382b9b88 --hash=sha256:930e33d92e7d991a1c194790c7fc7f3099f7ec1447e853b4218cba914bee3b7b! Will try again.
     ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 3/3 — 00:00:00
Installing initially failed dependencies...
[InstallError]:   File "/home/linuxbrew/.linuxbrew/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/cli/command.py", line 233, in install
[InstallError]:       retcode = do_install(
[InstallError]:   File "/home/linuxbrew/.linuxbrew/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/core.py", line 2052, in do_install
[InstallError]:       do_init(
[InstallError]:   File "/home/linuxbrew/.linuxbrew/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/core.py", line 1304, in do_init
[InstallError]:       do_install_dependencies(
[InstallError]:   File "/home/linuxbrew/.linuxbrew/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/core.py", line 899, in do_install_dependencies
[InstallError]:       batch_install(
[InstallError]:   File "/home/linuxbrew/.linuxbrew/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/core.py", line 796, in batch_install
[InstallError]:       _cleanup_procs(procs, failed_deps_queue, retry=retry)
[InstallError]:   File "/home/linuxbrew/.linuxbrew/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/core.py", line 703, in _cleanup_procs
[InstallError]:       raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: Traceback (most recent call last):
[pipenv.exceptions.InstallError]:   File "/home/yuhao/.local/share/virtualenvs/mimic-S86aAYuU/bin/pip", line 5, in <module>
[pipenv.exceptions.InstallError]:     from pip._internal.cli.main import main
[pipenv.exceptions.InstallError]:   File "/home/yuhao/.local/share/virtualenvs/mimic-S86aAYuU/lib/python3.7/site-packages/pip/_internal/cli/main.py", line 10, in <module>
[pipenv.exceptions.InstallError]:     from pip._internal.cli.autocompletion import autocomplete
[pipenv.exceptions.InstallError]:   File "/home/yuhao/.local/share/virtualenvs/mimic-S86aAYuU/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
[pipenv.exceptions.InstallError]:     from pip._internal.cli.main_parser import create_main_parser
[pipenv.exceptions.InstallError]:   File "/home/yuhao/.local/share/virtualenvs/mimic-S86aAYuU/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
[pipenv.exceptions.InstallError]:     from pip._internal.cli import cmdoptions
[pipenv.exceptions.InstallError]:   File "/home/yuhao/.local/share/virtualenvs/mimic-S86aAYuU/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
[pipenv.exceptions.InstallError]:     from pip._internal.exceptions import CommandError
[pipenv.exceptions.InstallError]:   File "/home/yuhao/.local/share/virtualenvs/mimic-S86aAYuU/lib/python3.7/site-packages/pip/_internal/exceptions.py", line 10, in <module>
[pipenv.exceptions.InstallError]:     from pip._vendor.six import iteritems
[pipenv.exceptions.InstallError]: ModuleNotFoundError: No module named 'pip._vendor.six'
ERROR: Couldn't install package: msgpack
 Package installation failed...
  ☤  ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 2/3 — 00:00:00

我该如何解决这个问题?我尝试通过 pip3linuxbrew 重新安装我的 pipenv,但没有解决问题。我的 OS 是 Ubuntu 20.04.

我解决这个问题的方法是通过 brew 重新安装 pipenv,如 documentation.

中所述

因为在 uninstall/installing 过程后环境目录没有被删除,我不得不手动删除它并通过以下方式创建一个新目录:

sudo rm -rf /home/yuhao/.local/share/virtualenvs/mimic-S86aAYuU

pipenv install