-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython update
More file actions
81 lines (54 loc) · 2.76 KB
/
Python update
File metadata and controls
81 lines (54 loc) · 2.76 KB
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
#How to update from Python3.6 to python 3.7 and set-up the package that you used before.
step 0:
suggest:
pip3 freeze > requirements.txt
Using the requirements.txt for the package control
step 1:
--====================================================================================
##Install python 3.7 and set the link
LINK: https://tech.serhatteker.com/post/2019-09/upgrade-python37-on-ubuntu18/
Step 0: Check the current python version
Run below command to test the current version installed of python.
$ python3 --version
Output will be like:
python 3.6.8
Step 1: Install python3.7
Install python by typing:
$ sudo apt update -y
$ sudo apt install python3.7
Step 2: Add python 3.6 & python 3.7 to update-alternatives
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
Step 3: Update python 3 to point to python 3.7
By default, Python 3.6 is pointed to Python 3. That means when we run python3 it will execute as python3.6 binary but we want to execute this as python3.7.
Type this command to configure python3:
$ sudo update-alternatives --config python3
user@ubuntu1804:~$ sudo update-alternatives --config python3
There are 2 choices for the alternative python3 (providing /usr/bin/python3).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3.6 2 auto mode
1 /usr/bin/python3.6 1 manual mode
2 /usr/bin/python3.7 2 manual mode
Press <enter> to keep the current choice[*], or type selection number:
You should get the above output. Now type 2 and hit enter for Python 3.7. Remember the selection number may differ so choose the selection number which is for Python 3.7.
Alternative update python 3 to point to python3.7
/usr/bin/python3 is just a symlink. Delete it and make a new symlink to python3.7:
-----The below two commands are not very neccessary
$ sudo rm /usr/bin/python3
$ sudo ln -s python3.7 /usr/bin/python3
---------------------------------------------------------
Step 4: Test the new version of python3
$ python3 -V
=============================================================================
step 2:
pip3 -r requirements.txt
To update and set up the package you need for python 3.7. If problem encounter, delete the relative item and continue. Then install those package later
In new version: should use : python3.7 -m pip -r requrements.txt
step 3:
problem might meet:
Unable to open the terminal in linux:
cd /usr/lib/python3/dist-packages
sudo ln -s apt_pkg.cpython-{36m,37m}-x86_64-linux-gnu.so
sudo ln -s /usr/lib/python3/dist-packages/gi/_gi.cpython-{36m,37m}-x86_64-linux-gnu.so
Then allas gut.