Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Starting Python
Search
Kentaro Kawano
July 10, 2017
Programming
0
38
Starting Python
Pythonを始められるような基本的なところ
Kentaro Kawano
July 10, 2017
Tweet
Share
More Decks by Kentaro Kawano
See All by Kentaro Kawano
Goでのレシーバーとnilの関係 / Receiver and nil relationship in Go
kawaken
0
390
Goの時刻に関するテスト/Testing time in Go
kawaken
0
41
AWS Lambda + Go
kawaken
0
35
goaのdesignをラクに書く/Write goa design easily
kawaken
0
31
Goでのチーム開発とコード管理の悩み/Team development and code management in Go
kawaken
0
37
Pyvmomiとansibleのdynamic inventory
kawaken
0
43
Other Decks in Programming
See All in Programming
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
240
今からはじめるAndroidアプリ開発 2024 / DevFest 2024
star_zero
0
780
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
360
物流システムにおけるリファクタリングとアーキテクチャの再構築 〜依存関係とモジュール分割の重要性〜
deeprain
1
770
競技プログラミングで 基礎体力を身につけよう / You can get basic skills through competitive programming
mdstoy
0
150
第5回日本眼科AI学会総会_AIコンテスト_3位解法
neilsaw
0
140
N.E.X.T LEVEL
pluu
2
270
React への依存を最小にするフロントエンド設計
takonda
21
8.9k
ソフトウェアの振る舞いに着目し 複雑な要件の開発に立ち向かう
rickyban
0
820
似たもの同士のPerlとPHP
uzulla
1
110
PipeCDの歩き方
kuro_kurorrr
4
140
CSC305 Lecture 26
javiergs
PRO
0
110
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
65
11k
4 Signs Your Business is Dying
shpigford
181
21k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Bash Introduction
62gerente
608
210k
How GitHub (no longer) Works
holman
310
140k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
How to Ace a Technical Interview
jacobian
276
23k
Automating Front-end Workflow
addyosmani
1366
200k
Navigating Team Friction
lara
183
15k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Transcript
Pythonͷ࢝Ίํ
࠷ۙPython͕Γ্͕͍ͬͯΔ
201511݄Ҏ߱(46த)
Δ͔͠ͳ͍ʂ ͜ͷϏοάΣʔϒʹʂ
CentOSͳΒPython͕ΠϯετʔϧࡁΈ $ python Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print "Hello World" Hello World >>> exit()
͓ΘΓ
ͱ͍͏༁ʹ͍͔ͳ͍
CentOSͰ όʔδϣϯ͕ݹ͍
PythonͷόʔδϣϯҠߦʹ͍ͭͯ ɺ͍͜ͱͬͯΔͱͯ͠৭ʑ ࢥ͏ͱ͜Ζ͕͋Γ·͢ɻ͜ͷ͘ ͳΔͷͰࠓׂѪ͢Δ͚Ͳɺͱʹ͔ ͘ࠓʮPython3ܥΛ͏ʯͷ͕ྑ͍ Ͱ͢ɻͰɺAWSLambda2ܥͰπ ϥΠɻGoΛ͍·͠ΐ͏ɻ
None
Πϯετʔϧ(OLD) • xbuild ͕ศར $ git clone https://github.com/tagomoris/xbuild.git $ cd
xbuild $ ./python-install 3.5.2 ~/local/python-3.5.2
Πϯετʔϧ • ඪ४ͷΠϯετʔϥʔΛ͍·͠ΐ͏ • https://www.python.org/downloads/ • ࠷৽ 3.6.0 • όʔδϣϯϚωʔδϟෆཁʢޙड़ʣ
SDKͷόʔδϣϯཧ ෳͷPythonΛΠϯετʔϧ͢Δͱ… % ls /usr/local/bin/python3* /usr/local/bin/python3@ /usr/local/bin/python3.5m-config@ /usr/local/bin/python3-32@ /usr/local/bin/python3.6@ /usr/local/bin/python3-config@
/usr/local/bin/python3.6-32@ /usr/local/bin/python3.5@ /usr/local/bin/python3.6-config@ /usr/local/bin/python3.5-32@ /usr/local/bin/python3.6m@ /usr/local/bin/python3.5-config@ /usr/local/bin/python3.6m-config@ /usr/local/bin/python3.5m@ ͜͏ͳΔɻ
ݸผͷϓϩδΣΫτͷόʔδϣϯʁ • venv ΛͬͯSDKࣗମΛόϯυϧ͢Δ % pwd /Users/kekawano/hoge % python3.5 -m
venv venv % ls venv/ % ls venv/ bin/ include/ lib/ pip-selfcheck.json pyvenv.cfg
venv ͷ͍ํ • όʔδϣϯͷݻఆ • ͍͍ͨpython -m venv σΟϨΫτϦ໊ •
༗ޮԽ • source σΟϨΫτϦ໊/bin/activate • ແޮԽ • deactivate
ྫ % which python /usr/bin/python % source venv/bin/activate % which
python /Users/kekawano/hoge/venv/bin/python % python -V Python 3.5.1 % deactivate % python -V Python 2.7.10
ύοέʔδཧ • pip Λ͏ % which pip /Users/kekawano/hoge/venv/bin/pip % pip
install flask % pip show flask ... Location: /Users/kekawano/hoge/venv/lib/python3.5/site-packages ... • venv Ͱڥ͕ด͍ͯ͡ΔͷͰGlobalʹӨڹ͠ͳ͍ • PyPI - the Python Package Index : Python Package Index
؆୯ͳWebΞϓϦ from flask import Flask app = Flask(__name__) @app.route("/") def
hello(): return "Hello world!" if __name__ == "__main__": app.run()
Pythonͷಛ • ಈతܕ͚ݴޠ • Indented Block • ܭࢉͷϥΠϒϥϦ๛
࠷ۙͷPython • ඇಉظॲཧʹରԠ async/await • จࣈྻͷf-string • type hinting
ύοέʔδ • module = file • mod1.py • package =
directory • mod2/init.py
࣮ߦ python mod1.py python mod2 • mod2/main.py