pip, pyenv, BeautifulSoup4をインストールする

PythonによるWebスクレイピング」を読んでいる。

本書の実践をする上でPython, BeautifulSoup4 のインストールを行う必要がある。 そのインストール手順の備忘録。

install pip

$ wget https://bootstrap.pypa.io/get-pip.py
$ python get-pip.py

install pyenv

$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv

PATH setting for pyenv

add the below to ~/.bash_profile

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

reload bashrc

$ source ~/.bashrc

install specific python version via pyenv

$ pyenv --version
pyenv 1.0.10-24-gacbd736

# show installable version list
$ pyenv install --list
...
  stackless-3.3.5
  stackless-3.4.1
  stackless-3.4.2

# install specific version from the installable version list
$ pyenv install {version}

# set the version as global
$ pyenv global {version}

$ pyenv version
{version} (set by /home/uorat/.pyenv/version)

# make sure the python version
$ python -V
Python {version}

install beautifulsoup4

$ pip install beautifulsoup4

make sure to complete installing BeautifulSoup

$ python
>>> from bs4 import BeautifulSoup

completed if no error occurs!

PythonによるWebスクレイピング

PythonによるWebスクレイピング

本記事は Qiita に投稿しました。

pip, pyenv, BeautifulSoup4をインストールする on @Qiita http://qiita.com/tic40/items/1806ef4176fea50ae01d