先贴上我遇到的错误:
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-LXbVkV/python-igraph/setup.py'"'"'; __file__='"'"'/tmp/pip-install-LXbVkV/python-igraph/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-9RsQns
cwd: /tmp/pip-install-LXbVkV/python-igraph/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-LXbVkV/python-igraph/setup.py", line 465
raise RuntimeError(f"Failed to clean {folder} with git")
^
SyntaxError: invalid syntax
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
常见出错:
Could not compile the C core of igraph.
说是C core of igraph 没有安装。
解决方案:
先执行
sudo apt-get install -y libigraph0-dev
然后执行
sudo pip install python-igraph
我在实际安装中出的错
如图,意思是有个文件语法不对
在内网未查到相关解释,但 stack overflow上面的一个解答给了我解决思路
链接:链接
它的意思是因为我们现在的python版本<3.6,所以提示语法出错
当然 ,我并不这样认为,但这也给了我灵感,我考虑到,这可能是当前python版本并不支持高版本的python-igraph,那么我们确认一下
1.首先
执行:
pip install python-igraph==
查询可选安装版本,结果如图:下面红色区域为理论可安装版本
可以看到,可选项有0.9.6版本,但实际上我们无法安装(第一张图,默认安装0.9.6版本)
2.那么,我们指定其他版本来安装
pip指定版本的命令很简单,查询过可选版本号之后
pip install software_name==版本号
当我执行:
pip install python-igraph=0.7
如图,成功:
欢迎讨论