简体   繁体   English

如何在Mac上安装Selenium Python

[英]How to install selenium python on Mac

I've downloaded the Selenium zip file for python and it contains the folder with the setup.py. 我已经下载了python的Selenium zip文件,它包含带有setup.py的文件夹。 It says on python.org that I have to type in terminal 'python setup.py install' but it gives me this error that I need to be administrator because I have no permission to the directory, when in fact my user is already an administrator: 它在python.org上说我必须输入终端“ python setup.py install”,但它给了我这个错误,我需要成为管理员,因为我没有对该目录的权限,而实际上我的用户已经是管理员:

Checking .pth file support in /Library/Python/2.7/site-packages/
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 13] Permission denied: /Library/Python/2.7/site-packages/test-easy-install-1469.pth'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/Library/Python/2.7/site-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  https://pythonhosted.org/setuptools/easy_install.html

Please make the appropriate changes for your system and try again.`

I prefer not to touch Mac's default python. 我不想碰Mac的默认python。 Instead I would suggest to brew your own python 相反,我建议酿造自己的python

Install brew from https://brew.sh/ https://brew.sh/安装brew

then install python 然后安装python

brew install python3

Then install selenium 然后安装硒

pip3 install selenium

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM