250x250
꾸준희
Enough is not enough
꾸준희
전체 방문자
2,319,279
오늘
213
어제
774

공지사항

  • 꾸준희 블로그
  • 분류 전체보기 (580)
    • 생각 (14)
    • Book Review (38)
    • Paper Review (18)
    • Research Topic (126)
      • Deep Learning (24)
      • Pose Estimation (29)
      • Object Detection (22)
      • Object Segmentation (3)
      • Object Tracking (11)
      • Video Surveillance (4)
      • Action Recognition (6)
      • Stereo Vision (6)
      • 3D Reconstruction (4)
      • Machine Vision (2)
      • Image Processing (11)
      • Dataset (4)
    • Development (76)
      • NVIDIA DeepStream (3)
      • NVIDIA TensorRT (30)
      • NVIDIA TAO Toolkit (2)
      • ONNX (8)
      • PyTorch (5)
      • TensorFlow (15)
      • TensorFlow Lite (1)
      • GPU | CUDA | PyCUDA (12)
    • Programming (147)
      • GStreamer | FFmpeg (6)
      • Python (27)
      • C | C++ (15)
      • OpenCV (34)
      • Linux (36)
      • Embedded linux (7)
      • Etc. (22)
    • Computer Science (62)
      • 학부 및 대학원 과목 (22)
      • 선형대수학 및 기타 수학 (7)
      • SQL-D (33)
    • 삽질 기록 (49)
    • 기타 (50)
      • 참고자료 (30)
      • 좋은 글 (5)
      • 티스토리 (2)
      • 논문 작성 관련 참고 (10)
      • 메모 (0)

블로그 메뉴

  • 👀 CV
  • 🌸 GitHub
  • 💌 LinkedIn
  • 📚 방명록

최근 댓글

  • python으로 만든 코드를 이제 a⋯
    android 초보
  • cannot resolve symbol 'type'⋯
    android 초보
  • 정확히 뭐라고 뜨나요?
    꾸준희
  • 앗 ㅠ 제가 오랜만에 스킨을 바⋯
    꾸준희
  • 선생님 ㅜㅠ 각도 계산하는 부⋯
    android 초보
07-04 08:58

티스토리

hELLO · Designed By 정상우.
꾸준희

Enough is not enough

Programming/Python

[Python] Ubuntu 18.04 에서 Python3.5 빌드하여 설치하기

2021. 2. 17. 18:22
반응형

 

 

 

 

 

 

1. 필수 패키지 설치 1

apt-get install libssl-dev
apt-get install make build-essential libssl-dev zlib1g-dev libbz2-dev libsqlite3-dev

 

위와 같이 필요한 패키지를 설치하고 파이썬을 설치해야 정상 설치가 된다. 

 

 

 

1-1. 필수 패키지 설치 2

sudo apt-get install libssl1.0

 

필자는 추가로 위 패키지도 설치해주었다. 

 

위 패키지를 설치하지 않고 파이썬을 설치하고나서 pip 를 설치할 때 자꾸 아래와 같은 에러가 발생한다.

 

이것 때문에 2시간 삽질함, 아래는 삽질 기록이다. 

 

~$ curl https://bootstrap.pypa.io/get-pip.py | python3.5

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1884k  100 1884k    0     0  3709k      0 --:--:-- --:--:-- --:--:-- 3702k
Traceback (most recent call last):
  File "<stdin>", line 24244, in <module>
  File "<stdin>", line 199, in main
  File "<stdin>", line 82, in bootstrap
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 954, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 896, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1139, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1115, in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1096, in _legacy_get_spec
  File "<frozen importlib._bootstrap>", line 444, in spec_from_loader
  File "<frozen importlib._bootstrap_external>", line 533, in spec_from_file_location
  File "/tmp/tmpes20_bph/pip.zip/pip/_internal/cli/main.py", line 60
    sys.stderr.write(f"ERROR: {exc}")
                                   ^

 

위와 같은 에러를 치면 저 문법이 Python 3.5 와 호환되지 않아서

Python2.7 용 get-pip.py 를 설치해서 Python 3.5 를 설치하라고 나오는데, 그렇게 할 경우 또 아래와 같은 에러가 발생된다. 

 

~$ python3.5 get-pip.py 
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping
ERROR: Could not find a version that satisfies the requirement pip<21.0
ERROR: No matching distribution found for pip<21.0

 

 

 

 

 

2. 원하는 파이썬 버전의 다운로드 링크 복사하기 

 

www.python.org/

 

Welcome to Python.org

The official home of the Python Programming Language

www.python.org

 

 

3. 다운로드 및 압축풀기

$ wget <download link>
$ tar -zxvf Python-3.5.2.tgz

 

 

4. 설치하기

$ cd Python-3.5.2
$ ./configure
$ make
$ sudo make install

 

아래와 같이 뜨면 성공

Requirement already up-to-date: setuptools in /usr/local/lib/python3.5/site-packages/setuptools-33.1.1-py3.5.egg
Collecting pip
Installing collected packages: pip
Successfully installed pip-8.1.1

 

 

 

만약에 python 3.5 의 pip 를 이용하여 패키지를 설치하려는데, 아래와 같은 에러가 난다면 

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/seohee/.local/lib/python3.5/site-packages/pip/__main__.py", line 21, in <module>
    from pip._internal.cli.main import main as _main
  File "/home/seohee/.local/lib/python3.5/site-packages/pip/_internal/cli/main.py", line 60
    sys.stderr.write(f"ERROR: {exc}")
                                   ^
SyntaxError: invalid syntax

 

 

아래와 같이 다시 python 3.5 버전에 맞게 다시 설치해주도록 하자 

 

$ curl https://bootstrap.pypa.io/3.5/get-pip.py --output get-pip.py
$ python3 get-pip.py

 

 

 

 

 

 

 

 

고마운 출처 : stackoverflow.com/questions/37723236/pip-error-while-installing-python-ignoring-ensurepip-failure-pip-8-1-1-requir/37723517

 

pip error while installing Python: "Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS"

I downloaded the Python 3.5 source code and ran the following: $ tar -xf Python-3.5.2.tar.xz $ ./configure --with-ensurepip=upgrade $ make $ sudo make altinstall It proceeded well until make. Whe...

stackoverflow.com

 

참고자료 1 : bablabs.tistory.com/19

 

Ubuntu에 Python3.5 설치하기

[2017년 1월 17일 업데이트] AWS EC2 instance ubuntu가 16.04 LTS로 업데이트 되었으며 python 3.5.2가 기본으로 설치되어있습니다. 아래 포스팅에서는 virtualenvironment를 셋팅하는 부분만 참고하시면 될 것..

bablabs.tistory.com

참고자료 2 : stackoverflow.com/questions/65896334/python-pip-broken-wiith-sys-stderr-writeferror-exc

 

Python Pip broken wiith sys.stderr.write(f"ERROR: {exc}")

On fresh Vagrant VM using box bento/centos-7 the following commands corrupt my pip installation. yum update yum install epel-release -y yum install python-pip -y /usr/bin/pip2 install --upgrade pip

stackoverflow.com

 

반응형
저작자표시비영리
  • 카카오스토리
  • 트위터
  • 페이스북

'Programming > Python' 카테고리의 다른 글

[Python] google images download 이용하여 구글 검색 이미지 저장하기  (0) 2021.05.20
[Python] Ubuntu 18.04 에서 Python3.5 빌드하여 설치하기  (2) 2021.02.17
[Python] argparse(Argument Parser) 에서 boolean 값 받기  (0) 2021.01.14
[Python] pytube 이용하여 Youtube 영상 저장하기  (0) 2020.12.28
[Python] GPU 지정하여 Python 코드 실행하기  (0) 2020.11.20
[Python] 파일명 추출, 디렉토리 경로 추출  (0) 2020.11.20
    'Programming/Python' 카테고리의 다른 글
    • [Python] google images download 이용하여 구글 검색 이미지 저장하기
    • [Python] argparse(Argument Parser) 에서 boolean 값 받기
    • [Python] pytube 이용하여 Youtube 영상 저장하기
    • [Python] GPU 지정하여 Python 코드 실행하기
    꾸준희
    꾸준희
    생각과 기록 그리고 발전
    댓글쓰기
    1. 아무개
      2022.04.10 20:54
      감사합니다. 내용 잘사용합니다.
      수정/삭제댓글쓰기댓글보기
      1. 꾸준희
        2022.04.10 22:32 신고
        네 감사합니다 :)
        수정/삭제
    다음 글
    [Python] google images download 이용하여 구글 검색 이미지 저장하기
    이전 글
    [Python] argparse(Argument Parser) 에서 boolean 값 받기
    • 이전
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • ···
    • 27
    • 다음

    티스토리툴바