Because OS X El Capitan uses System Integrity Protection protection technology, error is generated when sudo pip install installs Python packages:
1File"/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/os.py", line Max,inchmakedirs2Makedirs (Head, Mode)3File"/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/os.py", line157,inchmakedirs4 mkdir(name, mode)5OSError: [Errno1] Operation not permitted:'/system/library/frameworks/python.framework/versions/2.7/selenium'
SIP related command csrutil:
1xx:~$ csrutil2Usage:csrutil <command>3 Modify the System Integrity Protection configuration. All configuration changes apply to the entire machine.4 Available Commands:5 6 Clear7Clear the existing configuration. Only availableinchRecovery OS.8 Disable9Disable the protection on the machine. Only availableinchRecovery OS.Ten Enable OneEnable the protection on the machine. Only availableinchRecovery OS. A Status - Display the current configuration. - the NetBoot -Add <address> -Insert a new IPV4 addressinchThe list of allowed NetBoot sources. - List + Print The list of allowed NetBoot sources. -Remove <address> +Remove an IPv4 address from the list of allowed NetBoot sources.
To view the current SIP status:
1 xx:~ $ csrutil Status2 System Integrity Protection status:enabled.
Path protected by sip:
- /system
- /usr
- /bin
- /sbin
- OS X Pre-installed apps
If you need to install the Python package globally, you need to close SIP first, as follows:
1. Restart the system, hold option in the restart process and select recover partition
2, enter the recovery system, click the menu "Utility", open the terminal, enter Csrutil disable
3. Normal restart
4, sudo pip install XX package
5, after the installation is recommended to enter the recovery partition through the terminal open Sip:csrutil enable
It is also recommended to install virtualenvafter the SIP is closed and then open the SIP for subsequent environmental management through VIRTUALENV.
Reference Links:
http://stackoverflow.com/questions/33004708/osx-el-capitan-sudo-pip-install-oserror-errno-1-operation-not-permitted
Http://www.cnblogs.com/xiongqiangcs/p/4914049.html
https://support.apple.com/en-us/HT204899
Mac OS X El Capitan (10.11) sudo pip install error "OSError: [Errno 1] Operation not permitted"