6
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

macでpython

Last updated at Posted at 2015-02-07

python

 macには入っている。

$ python --version
Python 2.7.6

pip

 pipをインストールする。

$ curl -kL https://raw.github.com/pypa/pip/master/contrib/get-pip.py | sudo python
Collecting pip
  Downloading pip-6.0.8-py2.py3-none-any.whl (1.3MB)
    100% |################################| 1.3MB 330kB/s
Installing collected packages: pip

Successfully installed pip-6.0.8

virtualenvwrapper

 開発環境をパックするため、virtualenvwrapperを入れて使っていく。

$ sudo pip install virtualenv virtualenvwrapper
  Running setup.py install for virtualenv-clone
    Installing virtualenv-clone script to /usr/local/bin


Successfully installed argparse-1.3.0 pbr-0.10.7 six-1.9.0 stevedore-1.2.0 virtualenv-12.0.7 virtualenv-clone-0.2.5 virtualenvwrapper-4.3.2

 シェル起動時に環境変数の設定とvirtualenvwapperのシェルを叩くように書いておく。

.bashrc
if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
    export WORKON_HOME=$HOME/.virtualenvs
    source /usr/local/bin/virtualenvwrapper.sh
fi

 即反映しておく。

$ . ~/.bashrc

 1つ作業場を作ってみる。

$ mkvirtualenv work
New python executable in work/bin/python
Installing setuptools, pip...done.

 環境を抜ける、入る。

$ deactivate
$ workon work

ipython

 ipythonとその他もろもろをインストールして、notebookを起動。emacs+ipythonかnotebookか迷ってるけど、notebookも起動できるように。

$ pip install ipython
Successfully installed gnureadline-6.3.3 ipython-2.4.0
$ pip install pyzmq
Successfully installed pyzmq-14.5.0
$ pip install jinja2
Successfully installed jinja2-2.7.3 markupsafe-0.23
$ pip install tornado
Successfully installed backports.ssl-match-hostname-3.4.0.2 certifi-14.5.14 tornado-4.0.2
$ ipthon notebook
6
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?