简体   繁体   中英

How to make python3.6 as default on ubuntu 14.04

Ubuntu 14.04 has 3 python versions installed 2.7/3.4/3.6;

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:        14.04
Codename:       trusty

python3 runs 3.4 by default.

$ python3
Python 3.4.3 (default, Nov 28 2017, 16:41:13)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

I want to make python 3.6 as default. How can I do it? Secondly, since python3.4 is default, pip3 uses it and is failing to install slackclient module which is more concerning

$ sudo pip3 install slackclient
Downloading/unpacking slackclient
  Downloading slackclient-2.1.0-py2.py3-none-any.whl (51kB): 51kB downloaded
Downloading/unpacking aiohttp>3.5.2 (from slackclient)
  Downloading aiohttp-3.5.4.tar.gz (1.1MB): 1.1MB downloaded
  Running setup.py (path:/tmp/pip_build_root/aiohttp/setup.py) egg_info for package aiohttp
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/aiohttp/setup.py", line 13, in <module>
        raise RuntimeError("aiohttp 3.x requires Python 3.5.3+")
    RuntimeError: aiohttp 3.x requires Python 3.5.3+
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_root/aiohttp/setup.py", line 13, in <module>

    raise RuntimeError("aiohttp 3.x requires Python 3.5.3+")

RuntimeError: aiohttp 3.x requires Python 3.5.3+

----------------------------------------
Cleaning up...

Any help is much appreciated.

I see python3 symlinks to python3.4, not sure if changing that will help as this is a production system so I don't want to do anything I don't know about.

/usr/bin$ ls -l python3.4*
-rwxr-xr-x 2 root root 3714088 Nov 28  2017 python3.4
lrwxrwxrwx 1 root root      33 Nov 28  2017 python3.4-config -> x86_64-linux-gnu-python3.4-config
-rwxr-xr-x 2 root root 3714088 Nov 28  2017 python3.4m
lrwxrwxrwx 1 root root      34 Nov 28  2017 python3.4m-config -> x86_64-linux-gnu-python3.4m-config

Actually this worked;

$ sudo pip3 install --upgrade pip
Downloading/unpacking pip from https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl#sha256=993134f0475471b91452ca029d4390dc8f298ac63a712814f101cd1b6db46676
  Downloading pip-19.1.1-py2.py3-none-any.whl (1.4MB): 1.4MB downloaded
Installing collected packages: pip
  Found existing installation: pip 1.5.4
    Not uninstalling pip at /usr/lib/python3/dist-packages, owned by OS
Successfully installed pip
Cleaning up...
$ sudo pip3 install slackclient
DEPRECATION: Python 3.4 support has been deprecated. pip 19.1 will be the last one supporting it. Please upgrade your Python as Python 3.4 won't be maintained after March 2019 (cf PEP 429).
WARNING: The directory '/home/blah/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/home/blah/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting slackclient
  Downloading https://files.pythonhosted.org/packages/7c/2f/9b6db4c7686be3dc6b4244eaef4f37226a2ccca1a796516d4adcdfeefe56/slackclient-1.3.2.tar.gz
Collecting websocket-client<0.55.0,>=0.35 (from slackclient)
  Downloading https://files.pythonhosted.org/packages/26/2d/f749a5c82f6192d77ed061a38e02001afcba55fe8477336d26a950ab17ce/websocket_client-0.54.0-py2.py3-none-any.whl (200kB)
     |████████████████████████████████| 204kB 2.3MB/s
Requirement already satisfied: requests<3.0a0,>=2.11 in /usr/local/lib/python3.4/dist-packages (from slackclient) (2.13.0)
Requirement already satisfied: six<2.0a0,>=1.10 in /usr/local/lib/python3.4/dist-packages (from slackclient) (1.10.0)
Building wheels for collected packages: slackclient
  Building wheel for slackclient (setup.py) ... done
  Stored in directory: /home/blah/.cache/pip/wheels/3b/d4/92/3458f0e1a3e1a9c8935d3b2db89a75d74d8d45601fedec752f
Successfully built slackclient
Installing collected packages: websocket-client, slackclient
Successfully installed slackclient-1.3.2 websocket-client-0.54.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM