-
Notifications
You must be signed in to change notification settings - Fork 0
/
Linux python idle jupyter notebook qtconsole pip install and tips
146 lines (102 loc) · 2.22 KB
/
Linux python idle jupyter notebook qtconsole pip install and tips
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
$ is from terminal
>>> is from Python
[] is from Jupyter
(Python2 is usually already installed)
To get and use Python3:
Linux package manager > install for Python3 (if not already installed):
python3
pip
idle3 (might be under tkinter3, which was used to program it)
jupyter notebook
Optional:
jupyter qtconsole
jupyter core
jupyter doc
In other words, whatever will create the files (view in Linux package manager > Package > Files):
/usr/bin/python3
/usr/bin/pip3
/usr/bin/idle3
/usr/bin/jupyter-notebook
Optional:
/usr/bin/jupyter-qtconsole
/usr/bin/jupyter
path to jupyter-doc
Run python3 (interactive mode):
$python3
>>> 1+1
ENTER
(returns 2)
>>> import os
>>> os.getcwd()
ENTER
(returns current working directory)
$exit()
Run python3 idle (GUI):
$idle3
>>>import os
>>>os.getcwd()
Can edit .py file:
File > New File
>>>print(1+1)
Run > Run Module
(returns 2)
>>>exit()
Run jupyter qtconsole (GUI):
$jupyter-qtconsole
OR
$jupyter qtconsole
(if jupyter core installed)
Can do multiline editing (Help > Show QtConsole help, q):
[]a=1
CTRL-ENTER
[]b=2
CTRL-ENTER
[]print(a+b)
ENTER
(returns 3)
Can copy-paste and run multiline:
copy-paste above code
ENTER
Can save as .html file and view:
File > Save to HTML > Save as qtconsole.html
Double-click qtconsole.html
[]exit
Run jupyter notebook (python3, ijavascript, etc. notebook):
This runs jupyter for the highest version of python installed on your computer:
$cd [working directory you want to use]
$jupyter-notebook
OR
$jupyter notebook
(if jupyter core installed)
File > New > Python3
Help > About (tells you python, notebook version)
[]1+1
SHIFT-ENTER
(returns 2)
Save as name.ipynb
Can only undo to latest checkpoint! To create multiple checkpoints, just create multiple copies:
File > Make A Copy
Close window
$CTRL-C
$y
Install modules (will be usable from both Python3 and Jupyter Notebook):
Linux package manager > install python3-[module name]
OR
$pip3 install [module name]
Recommended modules:
matbplotlib
numpy
scipy
pandas
opencv
tkinter
pycrypto
View Jupyter docs:
$cd [path to jupyter-doc]
$cat index.rst
OR
https://jupyter-notebook.readthedocs.io/en/latest/
https://jupyter-client.readthedocs.io/en/5.2.3/
etc.
Great tutorial:
https://ipython-books.github.io/