Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Starting Python
Search
Kentaro Kawano
July 10, 2017
Programming
0
39
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
42
AWS Lambda + Go
kawaken
0
36
goaのdesignをラクに書く/Write goa design easily
kawaken
0
33
Goでのチーム開発とコード管理の悩み/Team development and code management in Go
kawaken
0
38
Pyvmomiとansibleのdynamic inventory
kawaken
0
46
Other Decks in Programming
See All in Programming
Criando Commits Incríveis no Git
marcelgsantos
2
170
DevFest Tokyo 2025 - Flutter のアプリアーキテクチャ現在地点
wasabeef
5
900
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
300
プロダクトの品質に コミットする / Commit to Product Quality
pekepek
2
770
快速入門可觀測性
blueswen
0
320
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
CSC509 Lecture 14
javiergs
PRO
0
130
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
130
useSyncExternalStoreを使いまくる
ssssota
6
1k
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
650
Refactor your code - refactor yourself
xosofox
1
260
선언형 UI에서의 상태관리
l2hyunwoo
0
140
Featured
See All Featured
Fireside Chat
paigeccino
34
3.1k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
The Cost Of JavaScript in 2023
addyosmani
45
7k
GraphQLとの向き合い方2022年版
quramy
44
13k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
A Philosophy of Restraint
colly
203
16k
GitHub's CSS Performance
jonrohan
1030
460k
RailsConf 2023
tenderlove
29
940
How GitHub (no longer) Works
holman
311
140k
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