python pypi easy_install(setuptools) pip distutils 정리

 

파이썬을 공부하다보면 패키지를 설치하고 관리하게 되는데..

pypi, easy_install, setuptools, pip, distutils 등의 용어을 보게 된다..

각각이 어떤건지 헷갈려 하는 경우가 있어 정리해본다.

1. pypi
– the Python Package Index (파이썬용 패키지들을 관리하고 검색)
https://pypi.python.org/pypi

2. setuptools & easy_install
– Easily download, build, install, upgrade, and uninstall Python packages (알맞은 모듈(설치된 파이썬 버전에 맞는) 버전으로 내려 받아 설치까지 한 번에 해주는 기특한 툴)
– setuptools을 설치하면 PYTHON_HOME\Scripts\easy_install 이 생성
https://pypi.python.org/pypi/setuptools

3. pip
– A tool for installing and managing Python packages. (easy_install의 향상버전)
https://pypi.python.org/pypi/pip

4. distutils
– 본인이 만든 python 모듈을 배포를 하기 위해서 사용

setuptools 설치 및 실행
https://pypi.python.org/pypi/setuptools 에서 setuptools 0.9.6.tar.gz 다운로드
tar xvzf setuptools 0.9.6.tar.gz
python setup.py install
easy_install 모듈명

pip 설치 및 실행
https://pypi.python.org/pypi/pip 에서 pip-1.3.1.tar.gz 다운로드
tar xvzf pip-1.3.1.tar.gz
python setup.py install
pip install 모듈명

Proxy 환경에서 사용
Unix or Linux 계열

$ export HTTP_PROXY="http://user:password@yourproxy.com:port"
$ export HTTPS_PROXY="http://user:password@yourproxy.com:port"

Windows 계열

> set HTTP_PROXY=http://your.proxy.com:yourPort
> set HTTPS_PROXY=http://your.proxy.com:yourPort

pip의 경우는 아래와 같이 에러가 발생

C:\>pip install pypdf
Downloading/unpacking pypdf
  Could not fetch URL https://pypi.python.org/simple/pypdf/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed>
  Will skip URL https://pypi.python.org/simple/pypdf/ when looking for download links for pypdf
  Could not fetch URL https://pypi.python.org/simple/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed>
  Will skip URL https://pypi.python.org/simple/ when looking for download links for pypdf
  Cannot fetch index base URL https://pypi.python.org/simple/
  Could not fetch URL https://pypi.python.org/simple/pypdf/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed>
  Will skip URL https://pypi.python.org/simple/pypdf/ when looking for download links for pypdf
  Could not find any downloads that satisfy the requirement pypdf No distributions at all found for pypdf
Exception information:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\basecommand.py", line 139, in main
    status = self.run(options, args)
  File "C:\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\commands\install.py", line 266, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "C:\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\req.py", line 1026, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "C:\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\index.py", line 171, in find_requirement
    raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for pypdf

Storing complete log in C:\pip\pip.log

위의 문제를 해결하기 위해서 pip를 다운그레이드 해야 함.
참고 : https://groups.google.com/forum/#!msg/beagleboard/aSlPCNYcVjw/jneydhfHHZsJ

C:\>easy_install pip==1.2.1
Searching for pip==1.2.1
Reading http://pypi.python.org/simple/pip/
Best match: pip 1.2.1
Downloading https://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#md5=d
b8a6d8a4564d3dc7f337ebed67b1a85
Processing pip-1.2.1.tar.gz
Running pip-1.2.1\setup.py -q bdist_egg --dist-dir c:\users\200b\appdata\local\t
emp\easy_install-3dqpif\pip-1.2.1\egg-dist-tmp-t1dc5v
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.txt' found under directory 'do
cs\_build'
no previously-included directories found matching 'docs\_build\_sources'
Removing pip 1.3.1 from easy-install.pth file
Adding pip 1.2.1 to easy-install.pth file
Installing pip-script.py script to C:\Python27\Scripts
Installing pip.exe script to C:\Python27\Scripts
Installing pip.exe.manifest script to C:\Python27\Scripts
Installing pip-2.7-script.py script to C:\Python27\Scripts
Installing pip-2.7.exe script to C:\Python27\Scripts
Installing pip-2.7.exe.manifest script to C:\Python27\Scripts

Installed c:\python27\lib\site-packages\pip-1.2.1-py2.7.egg
Processing dependencies for pip==1.2.1
Finished processing dependencies for pip==1.2.1

C:\>pip --version
pip 1.2.1 from c:\python27\lib\site-packages\pip-1.2.1-py2.7.egg (python 2.7)

참고로
.bashrc 파일에 프록시 설정을 해두면 편하게 사용할 수 있다.

그리고 apt-get에서 proxy를 사용하기 위해서는 /etc/apt/apt.conf 파일에 아래구문 추가하면 된다.

Acuire::http::Proxy "[PROXY_ADDR:PORT]"

 

This entry was posted in Python/Ruby/Perl and tagged , , , , , . Bookmark the permalink.

One Response to python pypi easy_install(setuptools) pip distutils 정리

댓글 남기기