Cygwin環境にvirtualenvを入れてみた


セットアップ前の状態

$ apt-cyg list python
python

$ python --version
Python 2.7.10

setuptoolsのインストール

$ apt-cyg install python-setuptools

virtualenvのインストール

$ easy_install-2.7 virtualenv
Searching for virtualenv
Reading https://pypi.python.org/simple/virtualenv/
Best match: virtualenv 13.1.2
Downloading https://pypi.python.org/packages/source/v/virtualenv/virtualenv-13.1.2.tar.gz#md5=b989598f068d64b32dead530eb25589a
Processing virtualenv-13.1.2.tar.gz
Writing /tmp/easy_install-dgIpjZ/virtualenv-13.1.2/setup.cfg
Running virtualenv-13.1.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-dgIpjZ/virtualenv-13.1.2/egg-dist-tmp-O1OxjH
warning: no previously-included files matching '*' found under directory 'docs/_templates'
warning: no previously-included files matching '*' found under directory 'docs/_build'
creating /usr/lib/python2.7/site-packages/virtualenv-13.1.2-py2.7.egg
Extracting virtualenv-13.1.2-py2.7.egg to /usr/lib/python2.7/site-packages
Adding virtualenv 13.1.2 to easy-install.pth file
Installing virtualenv script to /usr/bin
Installing virtualenv-2.7 script to /usr/bin

Installed /usr/lib/python2.7/site-packages/virtualenv-13.1.2-py2.7.egg
Processing dependencies for virtualenv
Finished processing dependencies for virtualenv

virtualenv環境の作成

kunst@DESKTOP-A0MF4ER ~
$ mkdir myproject

kunst@DESKTOP-A0MF4ER ~
$ cd myproject/

kunst@DESKTOP-A0MF4ER ~/myproject
$ virtualenv .
New python executable in ./bin/python
Installing setuptools, pip, wheel...done.

kunst@DESKTOP-A0MF4ER ~/myproject
$ ls -l
合計 4
drwxrwxr-x+ 1 kunst なし 0 1月  15 21:08 bin
drwxrwxr-x+ 1 kunst なし 0 1月  15 21:08 include
drwxrwxr-x+ 1 kunst なし 0 1月  15 21:08 lib

pip installしてみる

kunst@DESKTOP-A0MF4ER ~/myproject
$ source bin/activate
(myproject)
kunst@DESKTOP-A0MF4ER ~/myproject
$ pip install cherrypy
Collecting cherrypy
  Downloading CherryPy-4.0.0.tar.gz (434kB)
    100% |████████████████████████████████| 438kB 390kB/s
Building wheels for collected packages: cherrypy
  Running setup.py bdist_wheel for cherrypy
  Stored in directory: /cygdrive/c/usr/home/.cache/pip/wheels/0b/a1/e1/8e7e0f3a71dce9f4ef4bf8667efcd772c594af46fe3c8bef66
Successfully built cherrypy
Installing collected packages: cherrypy
Successfully installed cherrypy-4.0.0
(myproject)

virtualenv環境から出る

kunst@DESKTOP-A0MF4ER ~/myproject
$ deactivate

kunst@DESKTOP-A0MF4ER ~/myproject
$ pip
-bash: pip: コマンドが見つかりません