1. 程式人生 > >macos pip install 一直報錯的解決方法

macos pip install 一直報錯的解決方法

執行

$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