Page 1 of 1

Deprecation: Python 2.7 [SOLVED]

Posted: Sat Apr 20, 2019 12:50 am
by Black Swordsman
So I am working on teaching myself python and have just been learning about virtualenv and how it can help to make things more stable when working with different versions of things but when I had set it up I had received the message

Code: Select all

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Is there a way that I can set up pip and virtualenv to default to Python 3.6 (which is already pre-installed onto mint)?

Code: Select all

System:    Host: raun-Game Kernel: 4.15.0-20-generic x86_64 bits: 64 gcc: 7.3.0
           Desktop: Cinnamon 3.8.9 (Gtk 3.22.30-1ubuntu2) Distro: Linux Mint 19 Tara
Machine:   Device: desktop Mobo: ASUSTeK model: P8Z77-V LX v: Rev X.0x serial: N/A
           BIOS: American Megatrends v: 2501 date: 07/21/2014
CPU:       Quad core Intel Core i7-3770K (-MT-MCP-) arch: Ivy Bridge rev.9 cache: 8192 KB
           flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 28084
           clock speeds: max: 3900 MHz 1: 1678 MHz 2: 1624 MHz 3: 1666 MHz 4: 1687 MHz 5: 1645 MHz 6: 1616 MHz
           7: 1625 MHz 8: 1670 MHz
Graphics:  Card: Advanced Micro Devices [AMD/ATI] Tahiti XT [Radeon HD 7970/8970 OEM / R9 280X] bus-ID: 01:00.0
           Display Server: x11 (X.Org 1.19.6 ) drivers: ati,radeon (unloaded: modesetting,fbdev,vesa)
           Resolution: 1920x1080@60.00hz
           OpenGL: renderer: AMD TAHITI (DRM 2.50.0, 4.15.0-20-generic, LLVM 7.0.0)
           version: 4.5 Mesa 18.2.8 Direct Render: Yes
Audio:     Card-1 Intel 7 Series/C216 Family High Definition Audio Controller
           driver: snd_hda_intel bus-ID: 00:1b.0
           Card-2 Advanced Micro Devices [AMD/ATI] Tahiti HDMI Audio [Radeon HD 7870 XT / 7950/7970]
           driver: snd_hda_intel bus-ID: 01:00.1
           Sound: Advanced Linux Sound Architecture v: k4.15.0-20-generic
Network:   Card: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
           driver: r8169 v: 2.3LK-NAPI port: d000 bus-ID: 03:00.0
           IF: enp3s0 state: down mac: <filter>
Drives:    HDD Total Size: 500.1GB (48.9% used)
           ID-1: /dev/sda model: ST500DM002 size: 500.1GB
Partition: ID-1: / size: 458G used: 228G (53%) fs: ext4 dev: /dev/sda1
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 29.8C mobo: 27.8C gpu: 46.0
           Fan Speeds (in rpm): cpu: 0
Info:      Processes: 249 Uptime: 5 days Memory: 5991.5/15988.2MB Init: systemd runlevel: 5 Gcc sys: 7.3.0
           Client: Shell (bash 4.4.191) inxi: 2.3.56 

Re: Deprecation: Python 2.7

Posted: Sat Apr 20, 2019 1:28 am
by deepakdeshp
If you want to use the 3.6 version, use it as the first shebang line in your script.
https://bash.cyberciti.biz/guide/Shebang
Your first line would be
#!/usr/bin/python3.6

Re: Deprecation: Python 2.7

Posted: Sat Apr 20, 2019 2:30 am
by Black Swordsman
I do not think that I am understanding you...do you mean my first line in whatever code that I am writing? or do you mean that I need to put that into terminal whenever I go to use Virtualenv?

Re: Deprecation: Python 2.7

Posted: Sat Apr 20, 2019 6:04 pm
by AndyMH
my first line in whatever code that I am writing
Yes
Is there a way that I can set up pip
Have you installed python3-pip? If so, then instead of typing pip install xyz in a terminal, it is pip3 install xyz.

Re: Deprecation: Python 2.7

Posted: Sun Apr 21, 2019 12:40 pm
by deepakdeshp
Black Swordsman wrote:
Sat Apr 20, 2019 2:30 am
I do not think that I am understanding you...do you mean my first line in whatever code that I am writing? or do you mean that I need to put that into terminal whenever I go to use Virtualenv?
That should be the first line in your script not in terminal. The link explain it

Re: Deprecation: Python 2.7

Posted: Tue Apr 23, 2019 8:40 pm
by Black Swordsman
Okay thank you, I think I understand now