More Related Content Similar to Softlayer勉強会#2 Similar to Softlayer勉強会#2 (20) More from Shuichi Yukimoto More from Shuichi Yukimoto (10) Softlayer勉強会#26. Pythonのインストール(続き)
• python.org(https://www.python.org/) にアクセスする.
• "Downloads" - "Windows" と進む.
• Latest Python 2 Release - Python 2.7.8 を選択する.
• Download から Windows x86 MSI Installer (2.7.8) (sig)
を選択し,python-2.7.8.msi をダウンロードする.
• ダウンロードした python-2.7.8.msi を使って Python を
インストールする.
• インストールが終わったら環境変数にパスを追加する.
• 参考:Windows 環境変数 Path の設定方法
• PATH = $PATH;C:Python27;C:Python27Scripts;
• コマンドプロンプトで
• > phython
• $ /usr/bin/ruby -e "$(/usr/bin/
curl -fsSL https://
raw.github.com/mxcl/
homebrew/master/Library/
Contributions/
install_homebrew.rb)”
• ~/.bashrc
!
• brew install python —framework
!
• easy_install pip
export PATH=/usr/local/bin:$PATH
export PATH=/usr/local/share/python:$PATH
Windows Mac
7. ライブラリなどのインストール
• distribute のインストール
• https://pypi.python.org/pypi/distribute/
0.7.3
• > python ez_setup.py
• > easy_install pip
!
• https://pypi.python.org/pypi/virtualenv/
1.9.1
• > cd virtualenv-1.9.1> python setup.py
install
• > python -m virtualenv C:¥venv33
• > C:¥venv33¥Scripts¥activate
• (venv33) C:¥> deactivate
• virtualenvのインストール
virtualenvwrapperのインストール
!
!
• virtualenvの作成
!
• virtualenvの環境に移動
!
• virtualenvのディアクティベート
Windows Mac
pip install virtualenv virtualenvwrapper
source /usr/local/bin/virtualenvwrapper.sh
mkvirtualenv softlayer
workon softlayer
deactivate
10. Pythonの文法
• インデント
for (int i = 0; i < 100; ++i) {
for (int j = 0; j < 100; ++j) {
if (i * j % 10 == 0)
printf("%d %dn", i, j);
}
}
for i in range(100):
for j in range(100):
if i * j % 10 == 0:
print "%d %d" % (i, j)
C言語 Python
12. for文
• 繰り返し構文
dict = [
{“python”:75, “ruby”:82},
{“python”:11, ”ruby”:99}
]
!
for value in dict:
... print value