macos pip install 一直报错的解决方法

来源:互联网 发布:汤神君没有朋友知乎 编辑:程序博客网 时间:2024/06/07 14:23

执行

$pip install xxx(软件名)

之后报一堆错,比如:

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-5CyiYk/python-gflags/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-_Mg7Um-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-5CyiYk/python-gflags/

或者:

raise ProtocolError('Connection broken: %r' % e, e)ProtocolError: ("Connection broken: error(60, 'Operation timed out')", error(60, 'Operation timed out'))

解决方法:在pip命令后面加上–user -U:

sudo pip install tensorflow --user -U

参考:
http://xiaorui.cc/2016/03/27/%E8%A7%A3%E5%86%B3mac-osx%E4%B8%8Bpip%E5%AE%89%E8%A3%85ipython%E6%9D%83%E9%99%90%E7%9A%84%E9%97%AE%E9%A2%98/

原创粉丝点击