python-igraph安装失败的解决方案

先贴上我遇到的错误:

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

如图,成功:
在这里插入图片描述
欢迎讨论

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

涛涛ALG

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值