I'm trying to compile a file using Python and I receive this message:

error: could not create '/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/tulip': Permission denied

Why is the permission denied? How can I fix this?

  • Why do you want to write a file there ? oO Oct 16 '12 at 17:56
  • Im trying to install a sub-module for python.
    – Render
    Oct 16 '12 at 17:58
  • 2
    Prepend your command with sudo
    – sjbx
    Oct 16 '12 at 19:04
  • 1
    A small nit, Python is an interpreter, not a compiler. The difference is that Python has to convert the source code to "machine code" every time it is run where compiled languages do that once and use the same generated machine code every time it is run. Typically compiled languages are faster, but for small tasks the shorter development time of python more than makes up for the runtime difference.
    – Ɱark Ƭ
    Oct 17 '12 at 13:36

It's trying to create a file in the system installation of Python (i.e. it's going in the root Library folder). That folder is only writeable by root (to prevent damaging important system files), hence why you're getting a permission error.

Running the command with sudo preceding it, i.e. sudo foo bar will give you the proper permissions, after asking for your password. Alternatively, you can use virtualenv to set up your own Python environment that will allow you to mess around without worrying about changing the system default install.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .