-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstall Python iPython Jupyter PyQt etc.txt
142 lines (115 loc) · 4.56 KB
/
Install Python iPython Jupyter PyQt etc.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
# is comment
$ means from terminal
>> means from python shell
Video Tutorial and Demo: https://youtu.be/0CErj2nTwrI
Install Python from python.org/downloads
Can apply below steps to any versions of Python: https://www.python.org/downloads/mac-osx/
Accepting defaults installs Python to /Library/Frameworks/Python.framework/Versions/3.7 (for version 3.7)
Note:
* http://www.python.org/download/mac/tcltk/
Python 3.6- (both IDLE and ipynb) crash when you run tkinter gui and press option-U
Python 3.7+ come with their own private version of Tcl/Tk 8.6 and no longer use system-supplied or third-party supplied versions of Tcl/Tk
* Python 3.7 (Python.org) and 2.7.x (automatically comes with Mac in /System/Library/Frameworks, you should normally not modify or delete files in /System/Library) can both be installed on your system and will not conflict.
* "One more thing: to verify the identity of secure network connections, this Python needs a set of SSL root certificates. You can download and install a current curated set from the Certifi project by double-clicking on the Install Certificates icon in the Finder window. See the ReadMe file for more information."
ReadMe says: "The bundled pip included with this installer has its own default certificate store for verifying download connections."
* At any rate, I haven't installed any certificates and it works just fine.
Run Python:
(Terminal)
$python3.7
>>>1+1
>>>exit()
or
$idle3.7
>>>1+1
>>>exit()
Upgrade Pip (Python package manager, automatically installed with Python3.4+):
(Terminal)
$pip3.7 install --upgrade pip --user
If not installed, install pip (for version, say, 3.5):
Download get-pip.py from http://pip.readthedocs.org/en/latest/installing.html into current directory
$sudo python3.5 get-pip.py
Uninstall pip (for, say, pip3.7):
$ pip3.7 uninstall pip
$ pip3.7
Reinstall pip (for, say, pip3.7):
$ python3.7 -m ensurepip --default-pip
Use pip to install/update Jupyter (previously called Ipython) + Notebook + Dependencies:
(Terminal)
(if anything is already installed, will tell you)
$pip3.7 install jupyter[all]
Find Jupyter Notebook path if needed:
Applications>Python3.7>Update Shell Profile.command
or
$pip3.6 show jupyter
Run Jupyter Notebook (runs in browser, even with no internet connection!):
(Terminal)
$jupyter notebook
or
$/Library/Frameworks/Python.framework/Versions/3.6/bin/jupyter notebook
(if you get error message:
execution error: "http://localhost:8888/tree…” doesn’t understand the “open location” message
then copy/paste http://localhost:8888/tree… into browser)
Check versions:
Help > About (includes Python version)
$jupyter --version
$jupyter notebook --version
$pip3.7 --version
$pip3.7 list (includes pip version)
Exit Jupyter Notebook:
(Close browser or Logout)
(Terminal)
[CTRL-C]
exit? y [Enter]
( Can uninstall a version of Jupyter Notebook:
(Terminal)
(uninstalls jupyter/notebook from python3.6, keeps jupyter/notebook from python3.7)
$pip3.6 uninstall jupyter notebook
Uninstalling jupyter…Proceed? y
Uninstalling notebook…Proceed? y )
Modules are just Python programs (.py files) located in the folder where Python is installed on your computer. You use them by:
Install modules:
(Terminal)
(anything you install in python will be usable in python notebook)
(if already installed, will tell you)
$pip3.7 install numpy scipy matplotlib openpyxl tkinter statsmodels (dependencies will be automatically installed: $pip3.7 install pandas patsy cython) scikit-learn
Check module is installed and works (for example tkinter):
(Terminal)
$python3.7
>>import tkinter
>>tkinter._test()
$exit()
Use module, check works (for example numpy):
(Terminal)
$python3.7
>>import numpy
>>print(numpy.array([1,2]))
$exit()
Install PyQt on Python2.7 using MacPorts:
(Terminal)
$port search pyqt4
$sudo port install py27-pyqt4 #installs PyQt4 on Python2.7 in Applications/Macports
( Can install TkInter on Python2.7 using MacPorts:
$sudo port install py27-tkinter )
Run PyQt:
Open Applications/MacPorts/Python2.7/IDLE
(IDLE = Python Shell)
$import PyQt4 #must type this exactly, if no error then you successfully installed PyQt
$exit()
Update versions:
install new python version by repeating above steps
$pip3.7 install -U pip
$pip3.7 install -U notebook
$pip3.7 install pipdate
$pipdate3
(updates all modules)
Uninstall old python versions if you'd like (for example Python3.7):
(from admin account)
$cd /Library/Frameworks/Python.framework/Versions
$sudo rm -rf 3.7
(type admin password)
$cd /usr/local/bin
$sudo rm -rf *3.7*
Applications > Python3.7 > Move To Trash
By the way, check out this cool thing:
$python3.7
>>> import this