-
Notifications
You must be signed in to change notification settings - Fork 0
/
Windows Python iPython Jupyter.txt
144 lines (102 loc) · 3.46 KB
/
Windows Python iPython Jupyter.txt
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
Python
$ means from commandline
>> means from Python commandline
Getting started:
https://automatetheboringstuff.com/chapter0/
Check whether your OS is 64-bit or 32-bit:
Start>Control Panel>System
check whether System Type says 64-bit or 32-bit
Install python3.7 64-bit (pip automatically comes with 3.4+) using:
https://www.python.org/downloads/release (x86-64 executable installer)
or
Install python3.7 32-bit on windows by going to https://www.python.org/downloads/, it will display "Download the latest version for Windows," then just click "Download Python 3.7."
Open python:
(applications>IDLE)
prints Python 3.7 (default, May 02 2018, 12:00:00) [MSC v.1500 64 bit (AMD64)] on win64
>>> 1+1
prints 2
Close python:
>>>exit()
Open python3.7 from commandline (Start > cmd in Windows):
Check path:
(System Properties > Environment Variables > System Variables>Path)
(copy C:...\Python37)
(from commandline)
$cd (paste C:...\Python37)
$dir
find the name of the python3.7.exe file: (in this case: python3.7)
Open python:
(type name of the python3.7.exe file)
$python3.7
Close python:
>>>exit()
Check pip3.7 works:
(from commandline)
(type name of the python3.7.exe file, -m, pip)
$ python3.7 -m pip
or
$pip3.7
or
$ python3.7 -m ensurepip --default-pip
Upgrade pip3.7:
$pip3.7 install --upgrade pip
Modules are just Python programs (.py files) located in the folder where Python is installed on your computer. You use them by:
Install module using pip3.7:
$ pip3.7 install numpy
Use module, check that it works:
(from IDLE)
>>> import numpy
>>> numpy.array([1,2,3])
(should print an array: array([1,2,3]))
View installed modules:
$pip3.7 list
You can apply the same procedure to any other version of Python: https://www.python.org/downloads/windows/
--------------------------------------------------
iPython/Jupyter Notebook
Use pip to install/update Jupyter (previously called Ipython) + Notebook + Dependencies:
(Commandline)
(if anything is already installed, will tell you)
(installs to Python3.7 using pip3.7)
$pip3.7 install jupyter[all]
Unfortunately it's in the wrong place.
View actual installed modules (right place):
$cd (paste C:...\Python37)
$cd lib
$dir
(shows all the modules as .py files)
To actually install modules in future:
get the .py file and put in C:...\Python37\lib
Uninstall Jupyter from Python3.7:
$pip3.7 uninstall jupyter[all]
Install Jupyter on Python3.6:
$python -m pip install jupyter[all]
Run Jupyter Notebook (right place) on Python3.7:
$jupyter notebook
(Choose location for notebook)
(Click New>Jupyter 3 Notebook)
(from Notebook)
>>>1+1
SHIFT-ENTER (runs code)
(result: 2)
If error:
Connecting to Kernel
A connection to the notebook server could not be established. The notebook will continue trying to reconnect, but until it does, you will NOT be able to run code. Check your network connection or notebook server configuration
Then:
$python -m pip install tornado==4.5.3
Exit Jupyter Notebook:
CTRL-C
# = comment
No undo, instead:
CTRL-S (Creates Checkpoint)
Revert to Checkpoint
#but can only have 1 checkpoint at a time :(
Instead, File > Make a copy
Evaluate cell:
[Shift-Enter]
#only outputs last output, for rest use print(ìtextî,calculations)
#Heading cells must also be evaluated
#to edit Heading cells, double-click
[*] means busy
must close plots in order for program to continue
To abort:
Kernel>Interrupt