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
https://youtu.be/hlBddMVRL9Q 1. 개요 OpenMediaVault(OMV)는 Debian 기반의 오픈소스 NAS(Network Attached Storage) 운영체제로, 웹 브라우저를 통해 스토리지,…
https://youtu.be/iCUa8Ua8fIg 1. 개요 Raspberry Pi OS Lite를 Raspberry Pi Imager를 이용하여 설치하는 방법을 설명합니다. 2.…
안녕하세요.이번에 CKA(Certified Kubernetes Administrator) 시험에서 90점으로 합격했습니다. (합격 기준 66점) 합격 자체도 기뻤지만, 이번 시험을 준비하면서…
https://youtu.be/n8-wlkZiqio 1. 개요 NFS(Network File System)를 설치하고, rw/ro 및 root_squash 옵션에 따른 접근 제어와 성능을 테스트하는 방법을 정리한 가이드입니다.…
https://youtu.be/4MVxzmepY3s 1. 개요 리눅스에서 정기적으로 실행되는 작업(백업, 로그 정리, 모니터링 등)은 cron 서비스를 통해 자동화할 수 있습니다.…
https://youtu.be/vPfxWFBE1yc 1. 개요 리눅스 서버를 운영할 때 사용자 계정 생성, 비밀번호 설정, 권한 부여, 계정…