"Python3 pip 설치"의 두 판 사이의 차이

(python pip 설치 troubleshooting)
잔글 (한줄 설치)
26번째 줄: 26번째 줄:
{{소스헤더|Linux}}
{{소스헤더|Linux}}
<source lang='console'>
<source lang='console'>
[root@zetawiki ~]# curl -LO https://bootstrap.pypa.io/get-pip.py
[root@zetawiki ~]# curl -LO https://bootstrap.pypa.io/get-pip.py | python
   % Total    % Received % Xferd  Average Speed  Time    Time    Time  Current
   % Total    % Received % Xferd  Average Speed  Time    Time    Time  Current
                                 Dload  Upload  Total  Spent    Left  Speed
                                 Dload  Upload  Total  Spent    Left  Speed
100 1734k  100 1734k    0    0  1133k      0  0:00:01  0:00:01 --:--:-- 1132k
100 1734k  100 1734k    0    0  1133k      0  0:00:01  0:00:01 --:--:-- 1132k
[root@zetawiki ~]# python3 get-pip.py
Collecting pip
Collecting pip
   Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
   Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)

2020년 7월 12일 (일) 16:53 판

  다른 뜻에 대해서는 윈도우 Python 3 설치 문서를 참조하십시오.

1 개요

python3에서 pip 설치

2 pyhton 버전 확인

python이 설치되어 있는지 확인합니다. 파이썬 버전은 3.5 이상이여야 합니다.

Linux
[root@zetawiki ~]# python3 --version
Python 3.5
Windows
C:\Users\zetawiki> python --version
Python 3.5

3 get-pip.py 다운로드 및 설치

  • 리눅스
Linux
[root@zetawiki ~]# curl -LO https://bootstrap.pypa.io/get-pip.py | python
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1734k  100 1734k    0     0  1133k      0  0:00:01  0:00:01 --:--:-- 1132k
Collecting pip
  Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
     |################################| 1.4MB 247kB/s
Installing collected packages: pip
Successfully installed pip-19.3.1
  • windows

https://bootstrap.pypa.io/get-pip.py 를 다운로드 받거나, 접속해서 모든것을 복사하신 뒤에 개별적으로 get-pip.py를 만든 후 붙여넣기를 합니다.

Windows
C:\Users\zetawiki> python get-pip.py
Collecting pip
  Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
     |################################| 1.4MB 247kB/s
Installing collected packages: pip
Successfully installed pip-19.3.1

4 오류 시 대처사항

간혹가다 데비안 계열에서 distutils.util이 없다고 뜰 때가 있다.

[root@zetawiki ~]# python3 get-pip.py
Traceback (most recent call last):
  File "get-pip.py", line 22711, in <module>
    main()
  File "get-pip.py", line 198, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    from pip._internal.cli.main import main as pip_entry_point
  File "/tmp/tmprgb6wpnl/pip.zip/pip/_internal/cli/main.py", line 10, in <module>
  File "/tmp/tmprgb6wpnl/pip.zip/pip/_internal/cli/autocompletion.py", line 9, in <module>
  File "/tmp/tmprgb6wpnl/pip.zip/pip/_internal/cli/main_parser.py", line 7, in <module>
  File "/tmp/tmprgb6wpnl/pip.zip/pip/_internal/cli/cmdoptions.py", line 19, in <module>
ModuleNotFoundError: No module named 'distutils.util'

이럴때에는

[root@zetawiki ~]# apt-get -y install python3-distutils

를 해주면 해결이 된다.

5 이후 사용법

Linux
python3 -m pip install -U <패키지 이름>
Windows
python -m pip install -U <패키지 이름>

6 같이 보기

7 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}