티스토리 뷰

OS/NanoPi

NanoPi NEO2 Black(H5) : Python 3.7.9 수동 설치

파란크리스마스 2022. 3. 10. 00:12
728x90

출처

Python 3.7.9 설치

기존에 설치 되어 있는 Python 삭제

pi@NanoPi-NEO2-Black:~$ sudo apt remove python3 python3.6 python3.6-minimal python3.6-dev python3-pip 
pi@NanoPi-NEO2-Black:~$ sudo apt autoremove

Python을 설치하기 전에 Python을 빌드하는 데 필요한 필수 패키지를 설치

pi@NanoPi-NEO2-Black:~$ sudo apt update 
pi@NanoPi-NEO2-Black:~$ sudo apt install -y --no-install-recommends libbluetooth-dev tk-dev uuid-dev wget ca-certificates gnupg2 dirmngr gcc build-essential wget zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev

Python 소스 다운로드

pi@NanoPi-NEO2-Black:~$ PYTHON_VERSION=3.7.9
pi@NanoPi-NEO2-Black:~$ wget "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"

Python 빌드

pi@NanoPi-NEO2-Black:~$ tar -xvf Python-$PYTHON_VERSION.tar.xz
pi@NanoPi-NEO2-Black:~$ cd Python-$PYTHON_VERSION/
pi@NanoPi-NEO2-Black:~/Python-3.7.9$ sudo ./configure --enable-loadable-sqlite-extensions \
  --enable-optimizations \
  --enable-option-checking=fatal \
  --enable-shared \
  --with-system-expat \
  --with-system-ffi \
  --without-ensurepip
pi@NanoPi-NEO2-Black:~/Python-3.7.9$ sudo make -j 2 PROFILE_TASK='-m test.regrtest --pgo \
  test_array test_base64 test_binascii test_binhex test_binop test_bytes test_c_locale_coercion \
  test_class test_cmath test_codecs test_compile test_complex test_csv test_decimal test_dict \
  test_float test_fstring test_hashlib test_io test_iter test_json test_long test_math test_memoryview \
  test_pickle test_re test_set test_slice test_struct test_threading test_time test_traceback test_unicode'
 
... 생략 ...
 
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2                  _lzma                 _sqlite3           
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
 
 
The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc                  atexit                pwd                
time                                                           
 
running build_scripts
copying and adjusting /home/pi/Python-3.7.9/Tools/scripts/pydoc3 -> build/scripts-3.7
copying and adjusting /home/pi/Python-3.7.9/Tools/scripts/idle3 -> build/scripts-3.7
copying and adjusting /home/pi/Python-3.7.9/Tools/scripts/2to3 -> build/scripts-3.7
copying and adjusting /home/pi/Python-3.7.9/Tools/scripts/pyvenv -> build/scripts-3.7
changing mode of build/scripts-3.7/pydoc3 from 644 to 755
changing mode of build/scripts-3.7/idle3 from 644 to 755
changing mode of build/scripts-3.7/2to3 from 644 to 755
changing mode of build/scripts-3.7/pyvenv from 644 to 755
renaming build/scripts-3.7/pydoc3 to build/scripts-3.7/pydoc3.7
renaming build/scripts-3.7/idle3 to build/scripts-3.7/idle3.7
renaming build/scripts-3.7/2to3 to build/scripts-3.7/2to3-3.7
renaming build/scripts-3.7/pyvenv to build/scripts-3.7/pyvenv-3.7
make[1]: Leaving directory '/home/pi/Python-3.7.9'

Python 3.7.9 설치

pi@NanoPi-NEO2-Black:~/Python-3.7.9$ sudo make install 
pi@NanoPi-NEO2-Black:~/Python-3.7.9$ sudo ldconfig 
pi@NanoPi-NEO2-Black:~/Python-3.7.9$ sudo find /usr/local -depth \
  \( \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
  -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \) -exec rm -rf '{}' +
pi@NanoPi-NEO2-Black:~/Python-3.7.9$ echo 'export PATH=$PATH:/usr/local/sbin' >> ~/.bashrc
pi@NanoPi-NEO2-Black:~/Python-3.7.9$ source ~/.bashrc

pip 설치

pi@NanoPi-NEO2-Black:~/Python-3.7.9$ cd ~
pi@NanoPi-NEO2-Black:~$ wget -O get-pip.py "https://github.com/pypa/get-pip/raw/d59197a3c169cef378a22428a3fa99d33e080a5d/get-pip.py" 
pi@NanoPi-NEO2-Black:~$ sudo python3 get-pip.py --disable-pip-version-check --no-cache-dir "pip==20.0.2"

설치 확인

pi@NanoPi-NEO2-Black:~$ python3 --version 
Python 3.7.9
pi@NanoPi-NEO2-Black:~$ pip3 --version 
pip 20.0.2 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함