CentOS 7.8 安装 Python 3.8.5
  TnD0WQEygW8e 2023年11月05日 37 0

 [root@VM-0-2-centos webapps]# which python3
/usr/bin/python3

https://danieleriksson.net/2017/02/08/how-to-install-latest-python-on-centos/

 

Use “make altinstall” to prevent problems

 

It is critical that you use make altinstall when you install your custom version of Python. If you use the normal make install you will end up with two different versions of Python in the filesystem both named python. This can lead to problems that are very hard to diagnose.

 

# Python 3.8.5:

 

wget http://python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz

 

tar xf Python-3.8.5.tar.xz

 

cdPython-3.8.5

 

./configure--prefix=/usr/local--enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"

 

make&&makealtinstall

 

# pwd
/usr/local/bin
# ls py*
pydoc3  pydoc3.8  python3.8  python3.8-config
/usr/local/bin/python3.8

 

# /usr/local/bin/python3.8
Python 3.8.5 (default, Sep  4 2020, 19:48:39)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cytpes
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cytpes'
>>> exit()

 

# python3.8
Python 3.8.5 (default, Sep  4 2020, 19:48:39)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cyptes
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'cyptes'

 

wget https://bootstrap.pypa.io/get-pip.py

 

python3.8 get-pip.py

 

 

# yum install libffi-devel
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.lzu.edu.cn
 * elrepo: mirrors.tuna.tsinghua.edu.cn
 * epel: my.mirrors.thegigabit.com
 * extras: mirror.lzu.edu.cn
 * updates: mirror.lzu.edu.cn
软件包 libffi-devel-3.0.13-19.el7.x86_64 已安装并且是最新版本
无须任何处理



【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  xaeiTka4h8LY   2024年04月26日   51   0   0 centoslinuxredis
TnD0WQEygW8e