Pipenv trouble on MacOS “TypeError: 'module' object is not callable”

冷暖自知 提交于 2020-01-01 07:50:46

问题


I'm starting to try and get a working pipenv, however on my Mac, it is appears that my Python enviroment is a little screwed. I removed OS X python following this post , and installed both python2.7 and python3.7 using brew. But now when trying to use pipenv(2.7) to create a virtualenv, and pipfile, I keep getting an error about python 3.7, when locking pacakges:

$ pipenv --python=/usr/local/bin/python install pynetbox ipaddress
Virtualenv already exists!
Removing existing virtualenv...
Creating a virtualenv for this project...
Pipfile: /Users/daniel/scripts/netbox/Pipfile

...

adding ipaddress to Pipfile's [packages]...
Pipfile.lock not found, creating...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
c/lib/python3.7/site-packages/pipenv/utils.py", line 250, in actually_resolve_deps
    req = Requirement.from_line(dep)
  File "/usr/local/Cellar/pipenv/2018.7.1/libexec/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/requirements.py", line 704, in from_line
    line, extras = _strip_extras(line)
TypeError: 'module' object is not callable
/usr/local/Cellar/pipenv/2018.7.1/libexec/lib/python3.7/site-packages/pipenv/_compat.py:113: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/var/folders/pc/hlxw3whn3cl1x3h45ll2m8gw0000gs/T/pipenv-TYWa8Y-requirements'>
  warnings.warn(warn_message, ResourceWarning)

I have reinstalled PIP, and python a few times, and no luck. Any ideas would be greatly appreciated. Im sure by python is probably just in some bad state :(


回答1:


This is a bug in pipenv caused by using it alongside the newest version of pip (18.1): https://github.com/pypa/pipenv/issues/2924. You need to downgrade pip — both inside and outside the pipenv environment — to version 18.0 in order for pipenv to work.




回答2:


Actual commands to do as the answer by @jwodder.

Run the following commands on the root directory.

pip install pipenv

Then

pipenv run pip install pip==18.0

Then

pipenv install



回答3:


The previous answers were correct at the time, but the issue seems to have been fixed in the latest version of pipenv. Updating it fixed it for me:

pip3 install --upgrade pipenv

This allows you to run the latest versions of both pip and pipenv without problems



来源:https://stackoverflow.com/questions/52706769/pipenv-trouble-on-macos-typeerror-module-object-is-not-callable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!