由于 [Errno 13] 权限被拒绝错误,无法安装 PyMySQL

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

我正在尝试通过 python 连接并下载 pymysql 以创建数据库,但是当我这样做时

pip install pymysql

进入终端我收到以下错误信息

 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.

我是 python 的新手,如有任何帮助,我们将不胜感激,在此先感谢

尝试:

sudo pip install pymysql      # Installs for all the users.

或者:

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