python - 使用 python3 构建 pynauty
问题描述
我正在尝试根据以下说明构建 pynauty: https ://web.cs.dal.ca/~peter/software/pynauty/html/install.html#build
我想指出我的主要目标是运行这个 python 代码: https ://github.com/calebh/dihash
可悲的是,我无法通过 pynauty 的制作阶段。如果我执行make pynauty
命令,我会收到以下错误:
cd nauty; make nauty.o nautil.o naugraph.o schreier.o naurng.o
make[1]: Entering directory '/home/pc/pynauty-0.6.0/nauty27rc5'
make[1]: 'nauty.o' is up to date.
make[1]: 'nautil.o' is up to date.
make[1]: 'naugraph.o' is up to date.
make[1]: 'schreier.o' is up to date.
make[1]: 'naurng.o' is up to date.
make[1]: Leaving directory '/home/pc/pynauty-0.6.0/nauty27rc5'
python setup.py build
running build
running build_py
running build_ext
building 'pynauty.nautywrap' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-8kFkPd/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Inauty -Isrc -I/usr/include/python2.7 -c src/nautywrap.c -o build/temp.linux-x86_64-2.7/src/nautywrap.o -O4 -fPIC
src/nautywrap.c:15:10: fatal error: Python.h: No such file or directory
15 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
make: *** [Makefile:36: pynauty] Error 1
我猜以上是因为我没有安装python-dev
包(我想为 python3 构建 if)。所以我为 python3 添加了一个别名:
aliast python=python3
。但是当我输入make
pynauty 的根目录时,我仍然收到一条消息,说检测到 python2:
Available targets:
pynauty - build the pynauty extension module
tests - run all tests
clean - remove all python related temp files and dirs
user-ins - install pynauty into ~/.local/
user-unins - uninstall pynauty from ~/.local/
virtenv-ins - install pynauty into the active virtualenv
virtenv-unins - uninstall pynauty from the active virtualenv
dist - create a source distribution
docs - build pyanauty documentation
clean-docs - remove pyanauty documentation
nauty-objects - compile only nauty.o nautil.o naugraph.o schreier.o naurng.o
nauty-progs - build all nauty programs
clean-nauty - a "distclean" for nauty
clobber - clean + clean-nauty + clean-docs
Python version: 2 7 17
Machine type: x86_64
解决方案
编辑Makefile
for nauty
。
更改PYTHON = python
为PYTHON = python3
, 和
PIP = pip
(PIP = pip3
或任何你调用 Python 3 的 pip )。
推荐阅读
- next.js - 当 Ant 设计组件延迟加载时,Nextjs 不会在导航时加载 css
- math - 如何用弧形角段几乎连接两个点?
- node.js - 为什么 ERR_SOCKET_TIMEOUT
- go - go refspec:已定义/未定义类型的可分配性
- python - 从多个 URL 中抓取相同的元素并写入 excel
- firebase - 将firebase添加到flutter web时出现问题,TypeError:无法读取未定义的属性(读取“应用程序”)
- php - cURL 从命令行工作,但不能从 PHP
- javascript - JS函数设置超时
- entity-framework-core - 动态更改数据库 EF Core
- firebase - Cloud Firestore 安全规则仅允许由经过身份验证的用户创建