I'm reading "Web Scraping with Python".
Web scraping with Python https://www.amazon.co.jp/dp/4873117615/ref=cm_sw_r_tw_dp_x_r1spzbAV22VJX
In order to practice this book, it is necessary to install Python and BeautifulSoup4. A memorandum of the installation procedure.
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!
This article is reprinted from my blog http://tic40.hatenablog.com/entry/2017/05/31/103459
Recommended Posts