1.pip安裝出現(xiàn)權限錯誤
Paste_Image.png
error: could not create '/System/Library/Frameworks/Python.framework/Versions/2.7/share': Operation not permitted
出現(xiàn)這個是因為macOS Sierra搞了奶啊的SIP機制(System Integrity Protection),真是閑的蛋疼,所以
a) 方案一:直接把sip給關閉了,簡單點,把你關了
重啟電腦,按住Command+R(直到出現(xiàn)蘋果標志)進入Recovery Mode(恢復模式)
左上角菜單里找到實用工具 -> 終端
輸入csrutil disable
回車
重啟Mac即可
b) 方案二:不那么粗暴,溫柔點,把你留著
pip install (package name) --user -U
2.出現(xiàn)如下錯誤
Paste_Image.png
方法:
用H標志
sudo -H pip install xxx
3.安裝PIL出現(xiàn)如下錯誤
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出現(xiàn)如下錯誤
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