计算化学公社

 找回密码 Forget password
 注册 Register
Views: 10140|回复 Reply: 11
打印 Print 上一主题 Last thread 下一主题 Next thread

[Linux] CentOS8.1上使用python故障及解决方案

[复制链接 Copy URL]

356

帖子

0

威望

2249

eV
积分
2605

Level 5 (御坂)

本帖最后由 gog 于 2020-5-30 23:47 编辑

CentOS8.1 使用的GCC 8.3.1,等。系统流畅程度比7.8版本快了些。还有就是安装了一个杀毒软件也不卡。
只是很闹心,会遇到些麻烦问题,需要逐一解决。比如缺Glu.h。

今天遇到的是Python使用

8.1默认python2.7,可选择python3.6.  而很多软件中,设置的,是查找Python命令。
今个创建了python软链接到python3.6,

编译程序,调用了python命令,就提示
fatal error: Python.h: No such file or directory。
尝试
dnf --enablerepo=PowerTools -y install python-dev,
不管用

请求高手们支个招!

1149

帖子

6

威望

6631

eV
积分
7900

Level 6 (一方通行)

2#
发表于 Post on 2020-5-30 23:48:52 | 只看该作者 Only view this author
sudo yum install python3-devel
你这个安装杀毒软件有点秀啊。。

465

帖子

1

威望

2318

eV
积分
2803

Level 5 (御坂)

3#
发表于 Post on 2020-5-31 02:10:02 | 只看该作者 Only view this author
本帖最后由 Daniel_Arndt 于 2020-6-4 05:54 编辑

根据我个人的记忆,CentOS 8里面有python3、python36、python3-devel、python36-devel这几个package。比较有意思的是,有python3-pip,但是没有python36-pip,有python3-nose,但是没有python36-nose。

我记得CentOS 7里面的yum依赖于python 2,所以说强行卸载操作系统自带的python(版本为2.7.5)很可能带来问题,在CentOS 7里面把python指向python3也很有可能出问题。我使用CentOS 7时,使用了centos-release-scl-rh源提供的rh-python36、rh-python36-python-pip、rh-python36-python-nose。我当时创建了一个名为env_python3.6的文件夹,里面有四个软链接:python3、pip、pip3、nosetests。python3指向/opt/rh/rh-python36/root/usr/bin/python3.6,pip和pip3均指向/opt/rh/rh-python36/root/usr/bin/pip3.6,nosetests指向/opt/rh/rh-python36/root/usr/bin/nosetests。我要用python 3.6时,是运行的“PATH=$HOME/bin/env_python3.6:$PATH python3”。

我建议的解决方案是这样的。我知道CentOS 8现在改用dnf了,但我不确定CentOS 8的yum是不是依赖于python 2。如果CentOS 8的yum依赖于python 2的话,建议你把软链接的名字由“python”改成“python3”。CentOS 8确实有缺package的时候,你可以用一个粗略的名字去 https://rpmfind.net/ 上搜索,搜索到的结果里面,你找出“Distribution”为“Fedora”或者“EPEL”的,然后下载。下载下来的包,你可以用“rpm -qpR”查看依赖,如果没有什么依赖问题的话,就可以用“yum localinstall”安装。

356

帖子

0

威望

2249

eV
积分
2605

Level 5 (御坂)

4#
 楼主 Author| 发表于 Post on 2020-5-31 08:32:20 | 只看该作者 Only view this author
Daniel_Arndt 发表于 2020-5-31 02:10
根据我个人的记忆,CentOS 8里面有python3、python36、pytho3-devel、python36-devel这几个package。比较有 ...

路径见附件或者附图

QQ截图20200531082745.png (234.84 KB, 下载次数 Times of downloads: 69)

Python路径

Python路径

356

帖子

0

威望

2249

eV
积分
2605

Level 5 (御坂)

5#
 楼主 Author| 发表于 Post on 2020-5-31 08:35:42 | 只看该作者 Only view this author
Daniel_Arndt 发表于 2020-5-31 02:10
根据我个人的记忆,CentOS 8里面有python3、python36、pytho3-devel、python36-devel这几个package。比较有 ...

软件默认调用 python。系统库中,默认只有python2和python36.
yum -y install python
Repository AppStream is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository PowerTools is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
CentOS-8 - AppStream                            6.0 kB/s | 4.3 kB     00:00   
CentOS-8 - Base - mirrors.aliyun.com            761  B/s | 3.9 kB     00:05   
CentOS-8 - Extras - mirrors.aliyun.com          5.1 kB/s | 1.5 kB     00:00   
Extra Packages for Enterprise Linux Modular 8 -  15 kB/s | 8.7 kB     00:00   
Extra Packages for Enterprise Linux 8 - x86_64   11 kB/s | 9.4 kB     00:00   
TeamViewer - x86_64                             1.9 kB/s | 2.5 kB     00:01   
No match for argument: python
There are following alternatives for "python": python2, python36
Error: Unable to find a match: python

465

帖子

1

威望

2318

eV
积分
2803

Level 5 (御坂)

6#
发表于 Post on 2020-6-4 07:03:56 | 只看该作者 Only view this author
gog 发表于 2020-5-31 08:35
软件默认调用 python。系统库中,默认只有python2和python36.
yum -y install python
Repository AppSt ...

我看见你截图里面的python指向的是python2,我感觉这应该没什么问题啊。

我用了PowerTools。我刚刚去我的虚拟机里面看了一下,有python2、python2-devel、python36、python36-devel这几个包。你先试试看装一下python36-devel,如果你是想用python3时遇上了“fatal error: Python.h: No such file or directory”这个错误的话。

339

帖子

0

威望

5049

eV
积分
5388

Level 6 (一方通行)

7#
发表于 Post on 2020-6-4 08:15:37 | 只看该作者 Only view this author
直接上 Anaconda或者Miniconda ?

2407

帖子

1

威望

5952

eV
积分
8379

Level 6 (一方通行)

8#
发表于 Post on 2020-6-4 09:16:50 | 只看该作者 Only view this author
chrinide 发表于 2020-6-4 08:15
直接上 Anaconda或者Miniconda ?

This is the right solution.
High-Performance Computing for You
为您专属定制的高性能计算解决方案

更多讯息,请访问:
https://labitc.top
http://tophpc.top:8080
电邮: ask@hpc4you.top

2407

帖子

1

威望

5952

eV
积分
8379

Level 6 (一方通行)

9#
发表于 Post on 2020-6-4 09:47:42 | 只看该作者 Only view this author
顺路评价一下啊,
直接把系统中的python2链接到python3, 但是又没有处理其他的Lib之类的,
就如同,把220V的交流电,直接插到手机上进行充电。

运气不好的时候,如此链接后,你会发现,dnf/yum就挂了。

High-Performance Computing for You
为您专属定制的高性能计算解决方案

更多讯息,请访问:
https://labitc.top
http://tophpc.top:8080
电邮: ask@hpc4you.top

356

帖子

0

威望

2249

eV
积分
2605

Level 5 (御坂)

10#
 楼主 Author| 发表于 Post on 2020-6-5 10:22:11 | 只看该作者 Only view this author
这个主意到不错。

66

帖子

0

威望

704

eV
积分
770

Level 4 (黑子)

11#
发表于 Post on 2020-7-8 23:27:07 | 只看该作者 Only view this author
大神,看不懂。。。

356

帖子

0

威望

2249

eV
积分
2605

Level 5 (御坂)

12#
 楼主 Author| 发表于 Post on 2020-7-15 17:25:01 | 只看该作者 Only view this author
huozhong 发表于 2020-7-8 23:27
大神,看不懂。。。

慢慢来吧。我也不是很明白。

本版积分规则 Credits rule

手机版 Mobile version|北京科音自然科学研究中心 Beijing Kein Research Center for Natural Sciences|京公网安备 11010502035419号|计算化学公社 — 北京科音旗下高水平计算化学交流论坛 ( 京ICP备14038949号-1 )|网站地图

GMT+8, 2025-8-14 10:44 , Processed in 0.334301 second(s), 23 queries , Gzip On.

快速回复 返回顶部 返回列表 Return to list