file-type

CentOS 7升级Python 3.8:从2.7到3.8的详细教程

TXT文件

下载需积分: 9 | 5KB | 更新于2024-08-07 | 82 浏览量 | 1 下载量 举报 收藏
download 立即下载
本文档主要介绍了如何在 CentOS 7 系统环境下升级 Python 版本,从旧的 2.7.5 版本升级到 3.8.0 版本。作为一篇实用的 IT 技术指南,文章详细描述了整个安装过程,适合有经验的用户或想要学习 Linux 环境下 Python 安装的初学者参考。 首先,作者强调了使用 root 用户进行操作,但在实际操作中并未使用 `sudo`,因为已经切换到了 `/usr/local` 目录,这个目录通常用于存储系统级别的软件。在 Linux 系统中,`/usr/local` 对应于 Windows 的 `C:\Program Files`,是常见的软件安装位置。 文章的第二步是下载目标 Python 版本的压缩包,这里使用的是国内镜像网站,以提高下载速度,如果需要使用官方源,读者可以自行替换。接下来,使用 `tar` 命令解压下载的压缩文件。 第四步,为了保持安装文件的组织性,作者创建了一个名为 `python3` 的子目录,将 Python 的安装文件放入其中。在接下来的编译与安装步骤中: 1. 进入解压后的 Python-3.8.0 目录。 2. 使用 `./configure` 命令生成 makefile 文件,并指定安装路径前缀为 `/usr/local/python3`。`./configure` 是一个自定义脚本,它会根据系统的特性调整编译选项,包括确定安装位置。 3. 使用 `make` 命令开始编译,这是根据 makefile 中的指示进行构建过程。 4. 最后,执行 `make install` 来完成安装,将编译好的 Python 解压到指定的路径。 然而,在这个过程中遇到了 `zipimport.ZipImportError: can't decompress data; zlib not available` 的错误,这是因为缺少 `zlib` 库。解决这个问题需要安装 zlib 库,可以通过运行 `yum install zlib-devel` 或者 `apt-get install zlib1g-dev`(取决于你的 CentOS 版本和包管理器)来解决。 总结来说,这篇文档提供了一套完整的 CentOS 7 系统升级 Python 到 3.8.0 的教程,涉及到了文件路径管理、下载、解压、编译和配置等多个环节,有助于系统管理员和开发者在遇到类似情况时快速解决。同时,它也提醒我们在安装过程中可能遇到的常见问题及解决策略,提高了整个安装过程的可靠性。

相关推荐

filetype

Processing /home/luli/DH-PTAM-master/pangolin Preparing metadata (setup.py) ... done Building wheels for collected packages: pangolin Building wheel for pangolin (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [41 lines of output] running bdist_wheel running build running build_py /home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` directly. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details. ******************************************************************************** !! self.initialize_options() installing to build/bdist.linux-x86_64/wheel running install copying ./pangolin.cpython-38-x86_64-linux-gnu.so -> / Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "/home/luli/DH-PTAM-master/pangolin/setup.py", line 30, in <module> setup( File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/__init__.py", line 117, in setup return distutils.core.setup(**attrs) File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 183, in setup return run_commands(dist) File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 199, in run_commands dist.run_commands() File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands self.run_command(cmd) File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/dist.py", line 999, in run_command super().run_command(command) File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 973, in run_command cmd_obj.run() File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/command/bdist_wheel.py", line 461, in run self.egg2dist(self.egginfo_dir, distinfo_dir) File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/command/bdist_wheel.py", line 590, in egg2dist raise ValueError(err) ValueError: Egg metadata expected at build/bdist.linux-x86_64/wheel/./pangolin-0.0.1-py3.8.egg-info but not found [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pangolin Running setup.py clean for pangolin Failed to build pangolin ERROR: Failed to build installable wheels for some pyproject.toml based projects (pangolin) (dhptam) luli@l

filetype

pip install cyvcf2 Collecting cyvcf2 Using cached cyvcf2-0.31.1.tar.gz (1.3 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Collecting numpy>=1.16.0 (from cyvcf2) Using cached numpy-2.2.3-cp312-cp312-win_amd64.whl.metadata (60 kB) Collecting coloredlogs (from cyvcf2) Using cached coloredlogs-15.0.1-py2.py3-none-any.whl.metadata (12 kB) Collecting click (from cyvcf2) Using cached click-8.1.8-py3-none-any.whl.metadata (2.3 kB) Collecting colorama (from click->cyvcf2) Using cached colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB) Collecting humanfriendly>=9.1 (from coloredlogs->cyvcf2) Using cached humanfriendly-10.0-py2.py3-none-any.whl.metadata (9.2 kB) Collecting pyreadline3 (from humanfriendly>=9.1->coloredlogs->cyvcf2) Using cached pyreadline3-3.5.4-py3-none-any.whl.metadata (4.7 kB) Using cached numpy-2.2.3-cp312-cp312-win_amd64.whl (12.6 MB) Using cached click-8.1.8-py3-none-any.whl (98 kB) Using cached coloredlogs-15.0.1-py2.py3-none-any.whl (46 kB) Using cached humanfriendly-10.0-py2.py3-none-any.whl (86 kB) Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB) Using cached pyreadline3-3.5.4-py3-none-any.whl (83 kB) Building wheels for collected packages: cyvcf2 Building wheel for cyvcf2 (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for cyvcf2 (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [84 lines of output] running bdist_wheel running build running build_py creating build\lib.win-amd64-cpython-312\cyvcf2 copying cyvcf2\cli.py -> build\lib.win-amd64-cpython-312\cyvcf2 copying cyvcf2\__init__.py -> build\lib.win-amd64-cpython-312\cyvcf2 copying cyvcf2\__main__.py -> build\lib.win-amd64-cpython-312\cyvcf2 running egg_info writing cyvcf2.egg-info\PKG-INFO writing dependency_links to cyvcf2.egg-info\dependency_links.txt writing e

m0_51042961
  • 粉丝: 0
上传资源 快速赚钱