Python 3.12.7 소스 설치합니다.
Rocky 9.5
Python 3.12.7
URL: https://www.python.org/downloads/
# dnf -y install wget
# wget https://www.python.org/ftp/python/3.12.7/Python-3.12.7.tgz
# dnf -y install tar gcc zlib-devel
# tar xvfz Python-3.12.7.tgz
# cd Python-3.12.7
# ./configure –prefix=/apps/python/3.12.7 –enable-shared –enable-optimizations
# make -j
# make install
# cd /apps/python/3.12.7/bin/
# ln -sf python3.12 python
# ln -sf pip3.12 pip
./configure --prefix=/apps/python/3.12.7 --enable-shared --enable-optimizations
1. --prefix
- 설명: Python 설치 디렉토리 지정
- 사용 목적: 여러 버전 관리 또는 비표준 경로 설치
2. --enable-shared
- 설명: 공유 라이브러리(.so) 생성
- 사용 목적: Python 임베딩 또는 동적 로드 기능 필요 시
3. --enable-optimizations
- 설명: 컴파일 최적화 활성화 (-O2, -O3 플래그 등)
- 사용 목적: Python 성능 향상
make -j
1. -j
- 설명: 병렬 컴파일
- 사용 목적: 빌드 속도 단축
# vim /apps/profile.d/python-3.12.7.sh
+ #!/bin/sh
+ PYTHONHOME=/apps/python/3.12.7
+ PATH=${PYTHONHOME}/bin:${PATH}
+ LD_LIBRARY_PATH=${PYTHONHOME}/lib:${LD_LIBRARY_PATH}
+ export PYTHONHOME PATH LD_LIBRARY_PATH
# source /apps/profile.d/python-3.12.7.sh
# python –version
Python 3.12.7
# pip –version
pip 24.2 from /apps/python/3.12.7/lib/python3.12/site-packages/pip (python 3.12)
# mkdir /usr/share/Modules/modulefiles/python
# vim /usr/share/Modules/modulefiles/python/3.12.7
#%Module
# Module description
proc ModulesHelp { } {
puts stderr "This module sets up the environment for Python 3.12.7."
}
module-whatis "Sets up Python 3.12.7 environment."
# Set PYTHONHOME
setenv PYTHONHOME /apps/python/3.12.7
# Prepend to PATH
prepend-path PATH /apps/python/3.12.7/bin
# Prepend to LD_LIBRARY_PATH
prepend-path LD_LIBRARY_PATH /apps/python/3.12.7/lib
# module avail python
-------------------- /usr/share/Modules/modulefiles ---------------------
python/3.12.7
# module load python/3.12.7
# python –version
Python 3.12.7
# pip –version
pip 24.2 from /apps/python/3.12.7/lib/python3.12/site-packages/pip (python 3.12)
# wget https://www.python.org/ftp/python/3.12.7/Python-3.12.7.tgz
-bash: wget: command not found
# dnf -y install wget
# tar xvfz Python-3.12.7.tgz
-bash: tar: command not found
# dnf -y install tar
# ./configure –prefix=/apps/python/3.12.7 –enable-shared –enable-optimizations
checking MACHDEP... "linux"
checking for gcc... no
checking for cc... no
checking for cl.exe... no
checking for clang... no
configure: error: in `/root/Python-3.12.7':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
# dnf -y install gcc
# make install
Traceback (most recent call last):
File "<frozen zipimport>", line 510, in _get_decompress_func
ModuleNotFoundError: No module named 'zlib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen zipimport>", line 558, in _get_data
File "<frozen zipimport>", line 513, in _get_decompress_func
zipimport.ZipImportError: can't decompress data; zlib not available
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 6, in <module>
File "<frozen runpy>", line 222, in run_module
File "<frozen runpy>", line 148, in _get_module_details
File "<frozen runpy>", line 112, in _get_module_details
File "<frozen zipimport>", line 137, in get_code
File "<frozen zipimport>", line 692, in _get_module_code
File "<frozen zipimport>", line 560, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/root/Python-3.12.7/Lib/ensurepip/__main__.py", line 5, in <module>
sys.exit(ensurepip._main())
^^^^^^^^^^^^^^^^^
File "/root/Python-3.12.7/Lib/ensurepip/__init__.py", line 284, in _main
return _bootstrap(
^^^^^^^^^^^
File "/root/Python-3.12.7/Lib/ensurepip/__init__.py", line 200, in _bootstrap
return _run_pip([*args, *_PACKAGE_NAMES], additional_paths)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/Python-3.12.7/Lib/ensurepip/__init__.py", line 101, in _run_pip
return subprocess.run(cmd, check=True).returncode
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/Python-3.12.7/Lib/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/root/Python-3.12.7/python', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmpbvwbu1r2/pip-24.2-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmpbvwbu1r2\', \'--root\', \'/\', \'--upgrade\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
make: *** [Makefile:2027: install] Error 1
# dnf -y install zlib-devel
1. 개요 Rocky Linux는 엔터프라이즈 환경에서 사용되는 RHEL(Red Hat Enterprise Linux)과 완전히 호환되는 오픈소스 Linux…
https://youtu.be/XwG4jBWakzQ 1. 개요 Supermicro IPMIView는 Supermicro에서 제공하는 IPMI (Intelligent Platform Management Interface) 기반의 통합 관리…
1. 개요 이 문서는 두 개의 NIC (enp5s0f0, enp5s0f1)를 bonding(active-backup) 방식으로 구성하고, 해당 bond 장치를 브리지(br0) 와 연결하여 KVM 가상머신에서…
1. 개요 KVM에서 NVIDIA GPU를 Passthrough 설정하여 VM에 할당할 때 RmInitAdapter failed 오류를 자주 접하게…
1. 개요 Proxmox에서 pGPU(Physical GPU)와 vGPU(Virtual GPU)를 동일한 서버에서 동시에 사용하는 방법을 정리합니다. 2. 버전…
1. 개요 Proxmox에서 vGPU를 설정하는 방법을 정리합니다. 2. 버전 Proxmox 8.2 3. vGPU란? vGPU(Virtual GPU)는…