Search code examples
pythonpymysql

Cannot install PyMySQL because of a [Errno 13] permission denied error


I am trying to connect and download pymysql to create databases through python but when I do

pip install pymysql

into the terminal I get the following error message

 ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pymysql'
Consider using the `--user` option or check the permissions.

I am very new to python so any help would be appreciated, thanks in advance


Solution

  • Try:

    sudo pip install pymysql      # Installs for all the users.
    

    Or:

    pip install pymysql --user    # Installs the package for the current user only.