[英]Python2: installing networkx
I'm tryng to install networkx on python 2.7.18:我正在尝试在 python 2.7.18 上安装 networkx:
pip2 install networkx
I get the following error:我收到以下错误:
Running setup.py install for networkx ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/1b/8lq89lxj07bd6rvtl1k6g1b80000gn/T/pip-install-xAglEZ/networkx/setup.py'"'"'; _file='"'"'/private/var/folders/1b/8lq89lxj07bd6rvtl1k6g1b80000gn/T/pip-install-xAglEZ/networkx/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file_, '"'"'exec'"'"'))' install --record /private/var/folders/1b/8lq89lxj07bd6rvtl1k6g1b80000gn/T/pip-record-cJQmE6/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/networkx
cwd: /private/var/folders/1b/8lq89lxj07bd6rvtl1k6g1b80000gn/T/pip-install-xAglEZ/networkx/
and in the end:最后:
error: could not create '/Library/Frameworks/Python.framework/Versions/2.7/share/doc/networkx-2.2': Permission denied
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/1b/8lq89lxj07bd6rvtl1k6g1b80000gn/T/pip-install-xAglEZ/networkx/setup.py'"'"'; _file='"'"'/private/var/folders/1b/8lq89lxj07bd6rvtl1k6g1b80000gn/T/pip-install-xAglEZ/networkx/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file_, '"'"'exec'"'"'))' install --record /private/var/folders/1b/8lq89lxj07bd6rvtl1k6g1b80000gn/T/pip-record-cJQmE6/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/networkx Check the logs for full command output.
What should I do?我应该怎么办?
This means that you don't have sufficient privileges.这意味着您没有足够的权限。
You can either run the command with sudo
(if you are a root user):您可以使用sudo
运行命令(如果您是 root 用户):
sudo pip2 install networkx
or just install it just for the current user或者只为当前用户安装它
pip2 install networkx --user
PS: Consider upgrading to pip3
. PS:考虑升级到pip3
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.