py2.7 on climate
仮想環境から出るには
$ souce deactivate
です.
メモ代わりにどのようにinstall したか書いておきます.なおanaconda2-5.0.0を
インストールしたのですけど,anaconda3-Xでもpython 2.7を入れるのには問題な
かったようで,そのうちやり直しておこうと思います.
cd /usr/local
sudo mkdir pyenv
sudo chown minobe pyenv
git clone https://github.com/yyuu/pyenv.git ./pyenv
pyenv install -l | grep ana # anaconda のversion確認
2系は2-5.0.0が最新
pyenv install anaconda3-5.0.0
pyenv global anaconda3-5.0.0 #環境を切り替え
/usr/local/pyenv/versions/anaconda3-5.0.0/bin/conda create --name py2.7 python=2.7 anaconda
pyenv local anaconda3-5.0.0/envs/py2.7
conda install --name py2.7 --channel conda-forge netcdf4
conda install --name py2.7 --channel conda-forge pygrib
conda install --name py2.7 --channel conda-forge xarray
conda install --name py2.7 --channel conda-forge iris
conda install --name py2.7 --channel conda-forge mpl_toolkits <- error
conda install --name py2.7 --channel conda-forge basemap
conda install --name py2.7 --channel conda-forge pynio pyngl # < these cannot install on python 3.6
.bashrcに以下を追加
export PYENV_ROOT="/usr/local/pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
alias activatepy27="source $PYENV_ROOT/versions/anaconda3-5.0.0/bin/activate py2.7"
export PYTHONPATH="/usr/local/lib/python.pth"
パッケージの追加方法は以下の通り
$ cd /usr/local
$ pyenv global anaconda3-5.0.0
$ cd pyenv
$ pyenv local anaconda3-5.0.0/envs/py2.7
$ /usr/local/pyenv/versions/anaconda3-5.0.0/bin/conda install --name py2.7 --channel conda-forge パッケージ名
2018/2/21 spectrumパッケージをconda-forge より追加インストール
2018/6/14 lagranto パッケージをconda-forge より追加インストール
2018/07/08 dill パッケージをconda-forge より追加インストール
2018/07/20 ecmwfapi パッケージを pip でインストール
2018/08/20 python-magicをconda-forgeより追加インストール
2018/08/20 cftimeをconda-forgeより追加インストール
2019/09/19 cdsapi (ERA5などのデータダウンロード用)をconda-forgeより追加インストール
2)ログインした後にターミナルから
$ activate27
と入力する.うまくいけばプロンプトの一部に(py2.7)と表示される.
export PYENV_ROOT="/usr/local/pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
alias activatepy27="source $PYENV_ROOT/versions/anaconda2-5.0.0/bin/activate py2.7"
export PYTHONPATH="/usr/local/lib/python.pth"
1)以下の4行を.bashrc (または.bash_plofileに付け足す.
ログインしなおした
cliamteのpythonにxarrayをインストールしたと前にメールで書きましたけれど,
実際にはインストールできていませんでした.たぶん自分の仮想環境にinstall
してしまっていたのでしょう.また,xarrayにはpython 2.7以上が必要で,
climate のpython 2.6にはインストールできないこともわかりました.
そこで,pyenv + anacondaの仮想環境の上にpython2.7を載せて,皆さんも使え
るようにしてみました.とりあえず吉田君は使えましたので,多分大丈夫でしょう.
この仮想環境を使うには,
My e-mail to poc 2017/10/11
POCの皆さん
見延です
My e-mail to poc 2017/10/11
Dear POC members:
I thought that I installed xarray to standard python on climate, but it seems that I did not (probably I installed to my virtual environment).
Moverover, I found that xrray needs at least python 2.7 and thus cannot be installed on the python 2.6 on climate.
So, I installed virtual environments for python, which can be used by other POC members including useful packages to our field, such as pygrib, iris.
When you want to use this python you need to edit .bashrc (or .bash_profile), adding the following four lines.
export PYENV_ROOT="/usr/local/pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
alias activatepy27="source $PYENV_ROOT/versions/anaconda3-5.0.0/bin/activate py2.7"
export PYTHONPATH="/usr/local/lib/python.pth"
After the editing, you will logoff/login or "source .bashrc", and then
$ activatepy27
If you are successful, "(py2.7)" will be shown as a part of prompt.
You can get out from the virtual environemnt for python 2.7, by
$ source deactivate.
Best regards,
Shoshiro