[software development] 安装python3.11 3.10 3.12出现如下错误,怎么解决?
Tofloor
poster avatar
134******68
deepin
2023-08-03 06:29
Author

Python/fileutils.c: In function ‘_Py_closerange’:
Python/fileutils.c:2635:9: error: implicit declaration of function ‘close_range’ [-Werror=implicit-function-declaration]
2635 | if (close_range(first, last, 0) == 0) {
| ^~~~~~~~~~~
cc1: some warnings being treated as errors
make: *** [Makefile:2483:Python/fileutils.o] 错误 1

Reply Favorite View the author
All Replies
deepin
2023-08-03 08:52
#1

65c91243d8c54da04c07fc70f5edd8c1.png

Reply View the author
shy
deepin
2023-08-03 17:51
#2

不建议自己编译...要用的话可以参考我在这里的回答https://bbs.deepin.org/zh/post/260297?offset=0&postId=1499350

另外deepinv23 默认就有py3.10..

Reply View the author
kzou
deepin
2023-08-03 18:28
#3

建议安装miniconda, 很容易的,下载一个安装文件,执行就好。然后通过conda 安装Python, 要啥版本都行,conda自动帮你把文件搞定。

到这里下载miniconda:

https://docs.conda.io/en/latest/miniconda.html

安装好后,关闭终端,再重新打开,就进入conda环境,也就是提示符前面有个 (base)。这个就是基本的conda。然后,假如你打算安装python 3.10, 就增加一个新的环境,给个名字比如MyPython,

conda create -n MyPython python=3.10

一通自动下载安装后,环境就建立了。用这个命令看看你有多少个conda环境:

conda env list

用下面这个命令进入你刚增加的环境MyPython

conda activate MyPython

进入后你的提示符前面就变成(MyPython). 然后你就可以使用python了,

python --version

Reply View the author
xia
deepin
2023-09-22 03:38
#4

系统:Linux liuxia-PC 6.1.11-amd64-desktop-hwe #23.01.00.14 SMP PREEMPT_DYNAMIC Fri May 12 14:47:29 CST 2023 x86_64 GNU/Linux

python:3.11.5

开始我遇到了和楼主一样的问题,之前我升级了一下软件包

sudo apt update
sudo apt upgrade

然后

sudo ./configure

sudo make

sudo make install

然后就成功了,个人觉得可能还是gcc或者其他相关编译软件包版本太低导致的,chatGPT说的挺对的

补充:我装完后有一个Bug,需要安装gnureadline(pip3 install gnureadline)就正常了。

https://www.cnblogs.com/salt-fish1/p/11276328.html

Reply View the author
心远地自偏
deepin
2023-11-18 01:14
#5

Python/fileutils.c 文件中加一行(报错行之前) extern int close_range(int first, int last, unsigned int flags);

我记得还有一个文件也会报这个错误,用同样的方法可以通过编译。

close_range 是5.9内核中加入的新内核调用,用 ./configure 配置时应该能看到这一项是支持的,可能 gcc11 还没有加入对该调用的声明,用 gcc12 编译不报这个错误。

Reply View the author
youjin1985
deepin
2024-01-31 14:08
#6

我记得还有一个文件也会报这个错误,用同样的方法可以通过编译。

还有在 Modules/_posixsubprocess.c 458 行左右

十分感谢, 我也遇到了这个, 按照如上就解决了

Reply View the author
andot
deepin
2024-04-17 23:02
#7
心远地自偏

Python/fileutils.c 文件中加一行(报错行之前) extern int close_range(int first, int last, unsigned int flags);

我记得还有一个文件也会报这个错误,用同样的方法可以通过编译。

close_range 是5.9内核中加入的新内核调用,用 ./configure 配置时应该能看到这一项是支持的,可能 gcc11 还没有加入对该调用的声明,用 gcc12 编译不报这个错误。

我用的 deepin v23 beta3,gcc --version 显示版本是 13.2.0,使用 pyenv 安装 python 但仍然有这个错误。在 arch、manjaro 上就没有这个问题。

Reply View the author
xia
deepin
2024-06-03 16:15
#8
It has been deleted!
xia
deepin
2024-06-03 16:39
#9
youjin1985

我记得还有一个文件也会报这个错误,用同样的方法可以通过编译。

还有在 Modules/_posixsubprocess.c 458 行左右

十分感谢, 我也遇到了这个, 按照如上就解决了

481行

Reply View the author