问题
I've downloaded the Selenium zip file for python and it contains the folder with the 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:
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.`
回答1:
I prefer not to touch Mac's default python. Instead I would suggest to brew your own python
Install brew from https://brew.sh/
then install python
brew install python3
Then install selenium
pip3 install selenium
来源:https://stackoverflow.com/questions/45998084/how-to-install-selenium-python-on-mac