python名称错误:名称';文件';没有定义
我对python知之甚少。我想开始项目工作,安装说明上说:python名称错误:名称';文件';没有定义,python,pip,gunicorn,Python,Pip,Gunicorn,我对python知之甚少。我想开始项目工作,安装说明上说: pip install -r requirements-dev.txt 简单易懂。问题是,我明白了: Downloading/unpacking gunicorn==0.13.4 (from -r requirements.txt (line 7)) Running setup.py egg_info for package gunicorn Traceback (most recent call last):
pip install -r requirements-dev.txt
简单易懂。问题是,我明白了:
Downloading/unpacking gunicorn==0.13.4 (from -r requirements.txt (line 7))
Running setup.py egg_info for package gunicorn
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-build-root/gunicorn/setup.py", line 18, in <module>
long_description = file(
NameError: name 'file' is not defined
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "/tmp/pip-build-root/gunicorn/setup.py", line 18, in <module>
long_description = file(
NameError: name 'file' is not defined
下载/解包gunicorn==0.13.4(从-r requirements.txt(第7行))
正在运行包gunicorn的setup.py egg\u信息
回溯(最近一次呼叫最后一次):
文件“”,第16行,在
文件“/tmp/pip build root/gunicorn/setup.py”,第18行,在
长描述=文件(
NameError:未定义名称“文件”
从命令python setup.py egg_info完成输出:
回溯(最近一次呼叫最后一次):
文件“”,第16行,在
文件“/tmp/pip build root/gunicorn/setup.py”,第18行,在
长描述=文件(
NameError:未定义名称“文件”
我不明白这个问题。也许有人能帮忙
我在ArchLinux上运行这个,python默认为Python3,项目不是Python3,但我不确定是否是它
谢谢。文件在您使用的Python3中没有定义。您正在安装的软件包不适合Python3,您应该安装Python2.7,然后重试
请参阅:您的项目似乎是用Python<3编写的。这是因为内置函数。请尝试使用Python或 编辑:顺便说一句,文章中明确提到 Gunicorn需要Python2.x>=2.5。计划支持Python3.x。 Python 3不支持
文件()
改为使用
open()
;请参阅。要解决此错误,只需从google.colab导入文件添加
在您的代码中!(如果OP真的使用Python 3.x)Gunicorn 0.13.4需要Python 2.x>=2.5。源代码:“安装”部分:对于声称不熟悉Python的人,我认为尝试将Gunicorn移植到Python 3可能是个坏主意:)。这是行不通的,在这里使用Python 2.7是更好的选择。我的错!我错过了这些词…抱歉:(你知道在2to3中从文件转换为打开的确切修复方法吗?我正在寻找它,但根据文档,这部分似乎需要手动更改,因为它没有实现:(