1.pip安装出现权限错误
Paste_Image.pngerror: could not create '/System/Library/Frameworks/Python.framework/Versions/2.7/share': Operation not permitted
出现这个是因为macOS Sierra搞了奶啊的SIP机制(System Integrity Protection),真是闲的蛋疼,所以
a) 方案一:直接把sip给关闭了,简单点,把你关了
重启电脑,按住Command+R(直到出现苹果标志)进入Recovery Mode(恢复模式)
左上角菜单里找到实用工具 -> 终端
输入csrutil disable
回车
重启Mac即可
b) 方案二:不那么粗暴,温柔点,把你留着
pip install (package name) --user -U
2.出现如下错误
Paste_Image.png方法:
用H标志
sudo -H pip install xxx
3.安装PIL出现如下错误
Collecting pil Could not find a version that satisfies the requirement pil (from versions: ) Some externally hosted files were ignored as access to them may be unreliable (use --allow-external pil to allow).No matching distribution found for pil
方法:
后来查了解决办法:见 http://stackoverflow.com/questions/19532125/cant-install-pil-after-mac-os-x-10-9
使用如下步骤pip install Pillow
4.安装LXML出现如下错误
Paste_Image.png方法:
sudo C_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2/libxml:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MaOSX10.12.sdk/usr/include pip install lxml
网友评论