当使用 pipenv 在安装依赖包时,出现如下问题,
> pipenv install
Pipfile.lock (ca72e7) out of date, updating to (c2d5f0)...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
python3.6/site-packages/pipenv/utils.py", line 402, in resolve_deps
req_dir=req_dir
File "/Users/helixcs/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/utils.py", line 250, in actually_resolve_deps
req = Requirement.from_line(dep)
File "/Users/helixcs/.pyenv/versions/3.6.5/lib/python3.6/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 704, in from_line
line, extras = _strip_extras(line) TypeError: 'module' object is not callable
检查Python 环境版本。
pipenv 版本
~ pipenv --version
pipenv, version 2018.7.1
pip 版本
~ pip --version
pip 18.1 from /Users/helix/anaconda3/lib/python3.6/site-packages/pip (python 3.6)
python 版本
~ python -V
Python 3.6.3 :: Anaconda custom (64-bit)
参考此 issue, 原来是 pip 版本太高, pipenv 还不支持 18.1 版本,故需要把 pip 版本降级。
pip install 'pip==18.0'
再次运行 pipenv install
> pipenv install
Pipfile.lock (ca72e7) out of date, updating to (c2d5f0)...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Installing dependencies from Pipfile.lock (c2d5f0)...
▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 58/58 — 00:02:05