pipenv install 安装虚拟环境时出现 AttributeError: 'NoneType' object has no attribute 'version_sort' 错误

 使用 pipenv 创建虚拟环境,执行 pipenv install 时,报:AttributeError: 'NoneType' object has no attribute 'version_sort'

 

执行命令如下:

1 pipenv install

 

报错如下:

 

解决方法:

来自网友方法一:适用于执行失败后未生成 Pipfile 和 Pipfile.lock两份文件 , 在执行命令后 添加python.exe 路径 即:pipenv install --python="D:\python\python37\python.exe",虚拟环境创建成功。

 

 

 

来自网友方法二:执行命令后报错了但是也生成了 Pipfile 和 Pipfile.lock 两份文件,在 Pipfile 文件中加入 python 版本号,再重新执行命令。

查看python版本号:cmd窗口输入 python --V

Pipfile 文件中加入 python 版本号:

[requires]
python_version = "3.7"

 

posted @ 2021-03-12 10:07  L的个人博客  阅读(377)  评论(0编辑  收藏  举报