Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

pip - python NameError: name 'file' is not defined

I dont know much about python. I want to start working on the project and the setup instruction says:

pip install -r requirements-dev.txt

Simple enougth. The problem is that I get this:

    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

I dont understand the problem. Maybe somebody can help out?

I run this on Arch Linux, python defaults to python 3 and the project is not python 3 but Im not sure if thats it.

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

file() is not supported in Python 3

Use open() instead; see Built-in Functions - open().


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...