13
Pipenv使用时出现TypeError、ResourceWarning、或ImportError错误的解决方法
source link: https://greyli.com/pipenv-install-got-typeerror-resourcewarning-or-importerror/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Pipenv使用时出现TypeError、ResourceWarning、或ImportError错误的解决方法
10月16日更新
Pipenv 10.13 据说已经修复所有相关问题,可以尝试更新:
$ python3 -m pip install --upgrade pip
$ python3 -m pip install --upgrade pipenv
Pipenv 2018.7.1
Pipenv 2018.7.1版本和最新版本的pip不兼容,根据不同的命令和环境,会出现下面的异常:
- TypeError: ‘module’ object is not callable (pipenv install)
- ResourceWarning: Implicitly cleaning up … (pipenv install)
- ImportError: cannot import name ‘get_installed_distributions’ (pipenv graph)
目前可以临时通过降级pip来解决:
$ python3 -m pip install pip==10.0.1
如果你使用Python2,则使用下面的命令:
$ python -m pip install pip==10.0.1
Pipenv 2018.10.9
如果使用的是最新的2018.10.9版本,那么在Python 2.7下会出现下列异常:
- ImportError: No module named weakref
- ImportError: No module named shutil_get_terminal_size
可以临时通过手动安装这两个库来解决:
$ pip install backports.weakref backports.shutil_get_terminal_size
Pipenv 修复版本发布后
等到Pipenv发布新版本修复了这些问题后,可以通过下面的命令升级pipenv和pip:
$ python3 -m pip install --upgrade pip
$ python3 -m pip install --upgrade pipenv
如果你在阅读《Flask Web开发实战》时还遇到了其他问题,可以先到FAQ中查看,没有解决可以在helloflask仓库创建issue。
《Pipenv使用时出现TypeError、ResourceWarning、或ImportError错误的解决方法》上有2条评论
- su 2018年10月15日下午4:07
今天在使用pipenv时就出现了这个问题,最后发现是pip 18.1 与 pipenv 2018.7.1 不兼容,pipenv shell 之后运行 pipenv install pip==18.0 解决
回复 ↓ -
感谢,确实是pipenv 2018.7.1的问题。
回复 ↓
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK