読者です 読者をやめる 読者になる 読者になる

python::pipとかpypiとかいうのを入れたい

mod_wsgiが入ったので、pipとかいうパッケージシステム便利という事で俺も!俺も!


2011/08/17 10:38
親切な通りすがり紳士から、「distributeを使うと良い按配」とのことで。
setuptools(ez_setup.py)のときと同じ手順で導入してみる。上書き的な事を期待。

rokujyouhitoma 2011/08/12 11:10
はじめまして。こんにちわ。

細かいことですが、setuptoolsではなくdistributeを使うことをおすすめします。

  1. wget http://python-distribute.org/distribute_setup.py
  2. python distribute_setup.py

理由は、setuptoolsはバグがあったりメンテが止まっています。setuptoolsの置き換えとしてdistributeが開発されており、完全な互換性を持っています。
詳しい話はこちらを参照ください。
http://blog.aodag.jp/2011/01/distutilssetuptoolsdistribute.html

ジェントルメン!



http://packages.python.org/distribute/
ここを見ると、「今日からその悪習を正しなさい!今すぐ!」って感じでした。


$ wget http://python-distribute.org/distribute_setup.py

--2011-08-17 10:37:45--  http://python-distribute.org/distribute_setup.py
python-distribute.org をDNSに問いあわせています... 88.191.66.185
python-distribute.org|88.191.66.185|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 15757 (15K) [text/x-python]
`distribute_setup.py' に保存中

100%[=============================================================================================================>] 15,757      29.6K/s 時間 0.5s    

2011-08-17 10:37:47 (29.6 KB/s) - `distribute_setup.py' へ保存完了 [15757/15757]




$ python distribute_setup.py

Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.19.tar.gz
Extracting in /tmp/tmpsupHB6
Now working in /tmp/tmpsupHB6/distribute-0.6.19
Installing Distribute
Before install bootstrap.
Scanning installed packages
Setuptools installation detected at /usr/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg
Egg installation
Patching...
Renaming /usr/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg into /usr/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg.OLD.1313545352.18
Patched done.
Relaunching...
Before install bootstrap.
Scanning installed packages
Setuptools installation detected at /usr/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg
Egg installation
Already patched.
running install
running bdist_egg
running egg_info
writing distribute.egg-info/PKG-INFO
writing top-level names to distribute.egg-info/top_level.txt
writing dependency_links to distribute.egg-info/dependency_links.txt
writing entry points to distribute.egg-info/entry_points.txt
reading manifest file 'distribute.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'distribute.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-i686/egg
running install_lib
running build_py
creating build
creating build/lib
copying pkg_resources.py -> build/lib
copying easy_install.py -> build/lib
copying site.py -> build/lib
creating build/lib/setuptools
copying setuptools/package_index.py -> build/lib/setuptools
copying setuptools/depends.py -> build/lib/setuptools
copying setuptools/__init__.py -> build/lib/setuptools
copying setuptools/sandbox.py -> build/lib/setuptools
copying setuptools/archive_util.py -> build/lib/setuptools
copying setuptools/dist.py -> build/lib/setuptools
copying setuptools/extension.py -> build/lib/setuptools
creating build/lib/setuptools/command
copying setuptools/command/install.py -> build/lib/setuptools/command
copying setuptools/command/bdist_rpm.py -> build/lib/setuptools/command
copying setuptools/command/alias.py -> build/lib/setuptools/command
copying setuptools/command/test.py -> build/lib/setuptools/command
copying setuptools/command/install_egg_info.py -> build/lib/setuptools/command
copying setuptools/command/install_scripts.py -> build/lib/setuptools/command
copying setuptools/command/__init__.py -> build/lib/setuptools/command
copying setuptools/command/register.py -> build/lib/setuptools/command
copying setuptools/command/install_lib.py -> build/lib/setuptools/command
copying setuptools/command/upload_docs.py -> build/lib/setuptools/command
copying setuptools/command/develop.py -> build/lib/setuptools/command
copying setuptools/command/upload.py -> build/lib/setuptools/command
copying setuptools/command/bdist_egg.py -> build/lib/setuptools/command
copying setuptools/command/saveopts.py -> build/lib/setuptools/command
copying setuptools/command/build_py.py -> build/lib/setuptools/command
copying setuptools/command/build_ext.py -> build/lib/setuptools/command
copying setuptools/command/sdist.py -> build/lib/setuptools/command
copying setuptools/command/bdist_wininst.py -> build/lib/setuptools/command
copying setuptools/command/egg_info.py -> build/lib/setuptools/command
copying setuptools/command/rotate.py -> build/lib/setuptools/command
copying setuptools/command/setopt.py -> build/lib/setuptools/command
copying setuptools/command/easy_install.py -> build/lib/setuptools/command
creating build/lib/setuptools/tests
copying setuptools/tests/test_build_ext.py -> build/lib/setuptools/tests
copying setuptools/tests/test_upload_docs.py -> build/lib/setuptools/tests
copying setuptools/tests/__init__.py -> build/lib/setuptools/tests
copying setuptools/tests/test_develop.py -> build/lib/setuptools/tests
copying setuptools/tests/test_packageindex.py -> build/lib/setuptools/tests
copying setuptools/tests/test_sandbox.py -> build/lib/setuptools/tests
copying setuptools/tests/doctest.py -> build/lib/setuptools/tests
copying setuptools/tests/test_easy_install.py -> build/lib/setuptools/tests
copying setuptools/tests/server.py -> build/lib/setuptools/tests
copying setuptools/tests/test_resources.py -> build/lib/setuptools/tests
copying setuptools/gui.exe -> build/lib/setuptools
copying setuptools/cli.exe -> build/lib/setuptools
creating build/bdist.linux-i686
creating build/bdist.linux-i686/egg
creating build/bdist.linux-i686/egg/setuptools
copying build/lib/setuptools/package_index.py -> build/bdist.linux-i686/egg/setuptools
copying build/lib/setuptools/depends.py -> build/bdist.linux-i686/egg/setuptools
copying build/lib/setuptools/__init__.py -> build/bdist.linux-i686/egg/setuptools
copying build/lib/setuptools/sandbox.py -> build/bdist.linux-i686/egg/setuptools
copying build/lib/setuptools/archive_util.py -> build/bdist.linux-i686/egg/setuptools
copying build/lib/setuptools/gui.exe -> build/bdist.linux-i686/egg/setuptools
copying build/lib/setuptools/dist.py -> build/bdist.linux-i686/egg/setuptools
copying build/lib/setuptools/cli.exe -> build/bdist.linux-i686/egg/setuptools
copying build/lib/setuptools/extension.py -> build/bdist.linux-i686/egg/setuptools
creating build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/install.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/bdist_rpm.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/alias.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/test.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/install_egg_info.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/install_scripts.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/__init__.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/register.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/install_lib.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/upload_docs.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/develop.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/upload.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/bdist_egg.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/saveopts.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/build_py.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/build_ext.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/sdist.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/bdist_wininst.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/egg_info.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/rotate.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/setopt.py -> build/bdist.linux-i686/egg/setuptools/command
copying build/lib/setuptools/command/easy_install.py -> build/bdist.linux-i686/egg/setuptools/command
creating build/bdist.linux-i686/egg/setuptools/tests
copying build/lib/setuptools/tests/test_build_ext.py -> build/bdist.linux-i686/egg/setuptools/tests
copying build/lib/setuptools/tests/test_upload_docs.py -> build/bdist.linux-i686/egg/setuptools/tests
copying build/lib/setuptools/tests/__init__.py -> build/bdist.linux-i686/egg/setuptools/tests
copying build/lib/setuptools/tests/test_develop.py -> build/bdist.linux-i686/egg/setuptools/tests
copying build/lib/setuptools/tests/test_packageindex.py -> build/bdist.linux-i686/egg/setuptools/tests
copying build/lib/setuptools/tests/test_sandbox.py -> build/bdist.linux-i686/egg/setuptools/tests
copying build/lib/setuptools/tests/doctest.py -> build/bdist.linux-i686/egg/setuptools/tests
copying build/lib/setuptools/tests/test_easy_install.py -> build/bdist.linux-i686/egg/setuptools/tests
copying build/lib/setuptools/tests/server.py -> build/bdist.linux-i686/egg/setuptools/tests
copying build/lib/setuptools/tests/test_resources.py -> build/bdist.linux-i686/egg/setuptools/tests
copying build/lib/pkg_resources.py -> build/bdist.linux-i686/egg
copying build/lib/easy_install.py -> build/bdist.linux-i686/egg
copying build/lib/site.py -> build/bdist.linux-i686/egg
byte-compiling build/bdist.linux-i686/egg/setuptools/package_index.py to package_index.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/depends.py to depends.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/sandbox.py to sandbox.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/archive_util.py to archive_util.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/dist.py to dist.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/extension.py to extension.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/install.py to install.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/bdist_rpm.py to bdist_rpm.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/alias.py to alias.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/test.py to test.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/install_egg_info.py to install_egg_info.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/install_scripts.py to install_scripts.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/register.py to register.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/install_lib.py to install_lib.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/upload_docs.py to upload_docs.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/develop.py to develop.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/upload.py to upload.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/bdist_egg.py to bdist_egg.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/saveopts.py to saveopts.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/build_py.py to build_py.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/build_ext.py to build_ext.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/sdist.py to sdist.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/bdist_wininst.py to bdist_wininst.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/egg_info.py to egg_info.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/rotate.py to rotate.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/setopt.py to setopt.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/command/easy_install.py to easy_install.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/tests/test_build_ext.py to test_build_ext.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/tests/test_upload_docs.py to test_upload_docs.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/tests/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/tests/test_develop.py to test_develop.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/tests/test_packageindex.py to test_packageindex.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/tests/test_sandbox.py to test_sandbox.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/tests/doctest.py to doctest.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/tests/test_easy_install.py to test_easy_install.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/tests/server.py to server.pyc
byte-compiling build/bdist.linux-i686/egg/setuptools/tests/test_resources.py to test_resources.pyc
byte-compiling build/bdist.linux-i686/egg/pkg_resources.py to pkg_resources.pyc
byte-compiling build/bdist.linux-i686/egg/easy_install.py to easy_install.pyc
byte-compiling build/bdist.linux-i686/egg/site.py to site.pyc
creating build/bdist.linux-i686/egg/EGG-INFO
copying distribute.egg-info/PKG-INFO -> build/bdist.linux-i686/egg/EGG-INFO
copying distribute.egg-info/SOURCES.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying distribute.egg-info/dependency_links.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying distribute.egg-info/entry_points.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying distribute.egg-info/entry_points.txt.orig -> build/bdist.linux-i686/egg/EGG-INFO
copying distribute.egg-info/top_level.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying distribute.egg-info/zip-safe -> build/bdist.linux-i686/egg/EGG-INFO
creating dist
creating 'dist/distribute-0.6.19-py2.5.egg' and adding 'build/bdist.linux-i686/egg' to it
removing 'build/bdist.linux-i686/egg' (and everything under it)
Processing distribute-0.6.19-py2.5.egg
creating /usr/lib/python2.5/site-packages/distribute-0.6.19-py2.5.egg
Extracting distribute-0.6.19-py2.5.egg to /usr/lib/python2.5/site-packages
Adding distribute 0.6.19 to easy-install.pth file
Installing easy_install script to /usr/bin
Installing easy_install-2.5 script to /usr/bin

Installed /usr/lib/python2.5/site-packages/distribute-0.6.19-py2.5.egg
Processing dependencies for distribute==0.6.19
Finished processing dependencies for distribute==0.6.19
After install bootstrap.
Creating /usr/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg-info
Creating /usr/lib/python2.5/site-packages/setuptools.pth
(ry

$ easy_install --version
distribute 0.6.19

で、目的のモノを入れる。

$ easy_install pip
Searching for pip
Reading http://pypi.python.org/simple/pip/
Reading http://www.pip-installer.org
Reading http://pip.openplans.org
Best match: pip 1.0.2
Downloading http://pypi.python.org/packages/source/p/pip/pip-1.0.2.tar.gz#md5=47ec6ff3f6d962696fe08d4c8264ad49
Processing pip-1.0.2.tar.gz
Running pip-1.0.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-p-awOQ/pip-1.0.2/egg-dist-tmp-FwrMOD
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
no previously-included directories found matching 'docs/_build/_sources'
Adding pip 1.0.2 to easy-install.pth file
Installing pip script to /usr/bin
Installing pip-2.5 script to /usr/bin

Installed /usr/lib/python2.5/site-packages/pip-1.0.2-py2.5.egg
Processing dependencies for pip
Finished processing dependencies for pip






以下、2011/08/12時点。

まずは、easy_install とかいうものが必要らしい感じ。

この辺参考に: http://ref.layer8.sh/ja/entry/show/id/1025

wget http://peak.telecommunity.com/dist/ez_setup.py

--2011-08-12 09:50:40--  http://peak.telecommunity.com/dist/ez_setup.py
peak.telecommunity.com をDNSに問いあわせています... 209.190.5.234
peak.telecommunity.com|209.190.5.234|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 10240 (10K) [text/plain]
`ez_setup.py' に保存中

100%[=============================================================================================================>] 10,240      29.6K/s 時間 0.3s    

2011-08-12 09:50:41 (29.6 KB/s) - `ez_setup.py' へ保存完了 [10240/10240]

ez_setup.py の実行。

python ez_setup.py

Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c11-py2.5.egg
Processing setuptools-0.6c11-py2.5.egg
Copying setuptools-0.6c11-py2.5.egg to /usr/lib/python2.5/site-packages
Adding setuptools 0.6c11 to easy-install.pth file
Installing easy_install script to /usr/bin
Installing easy_install-2.5 script to /usr/bin

Installed /usr/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11

インストール完了。
実行確認

easy_install

error: No urls, filenames, or requirements specified (see --help)

おk。
使い方分からんけど。