Last active
October 19, 2016 14:51
-
-
Save giisyu/bed7899b1b94d322612e to your computer and use it in GitHub Desktop.
python3と科学計算ライブラリ周りをUbuntuにインストール(virtualenv+pip) ref: http://qiita.com/jooex/items/61a9169f2f88580d15ff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# なんか入れる. | |
sudo apt-get -y update | |
sudo apt-get -y upgrade | |
sudo apt-get -y install build-essential | |
sudo apt-get -y install python3-dev | |
python -V | |
python3 -V | |
#pythonと打つとpython3になるようにする。(追記:バグの原因になるのでやらないほうがいいようだ) | |
#echo alias python=python3 >> ~/.bash_aliases | |
#source ~/.bash_aliases | |
#python -V | |
# pipを入れる。 | |
sudo apt-get install python3-setuptools | |
sudo easy_install3 pip | |
# pip の場所がpython3になっているか確認する。 | |
pip -V | |
# 現在入っているもの | |
pip list | |
#virtualenvを入れる | |
sudo pip install virtualenv | |
#projectディレクトリを作る | |
mkdir ./projectPath | |
cd ./projectPath | |
#環境を作って起動 | |
virtualenv venv | |
source venv/bin/activate | |
#gitignoreに加える | |
#echo venv >> .gitignore | |
#確認 | |
pip list | |
#以下はpipを使っていろいろ入れてみる。 | |
#numpyを入れる。 | |
pip install numpy | |
#scipyを入れる。fortranコンパイラがいる。 | |
sudo apt-get install libatlas-base-dev gfortran | |
pip install scipy | |
#matplotlib,seabornを入れる。freetypeがいる。 | |
sudo apt-get install libpng-dev | |
sudo apt-get install libfreetype6-dev | |
pip install matplotlib | |
pip install seaborn | |
#以下は必要ないかも。matplotlibで、qt4とpysideを使う場合。 | |
sudo apt-get install qt-sdk | |
sudo apt-get install cmake | |
sudo pip install pyside | |
#matplotlibの設定ファイルに書き込む | |
vim ~/.config/matplotlib/matplotlibrc | |
#backend : qt4agg | |
#backend.qt4 : PySide | |
#Jupyter | |
pip install jupyter | |
#testライブラリ | |
pip install nose | |
#その他 | |
pip install quandl | |
pip install scikit-learn | |
#書き出しておく | |
pip freeze > requirements.txt | |
#仮想環境から抜ける。 | |
deactivate | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%store foo >> a.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jupyter notebook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib inline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib qt4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ipython --matplotlib qt4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%load filename.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%run filename.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%writefile filename.py | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%history -n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%history -n range 2-3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%save -a filename.py 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
import seaborn as sns | |
x = np.random.normal(size=100) | |
sns.distplot(x, kde=False, rug=False, bins=10) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment