zoukankan      html  css  js  c++  java
  • (转)Using Python3.5 in Ubuntu

    转自:https://www.reddit.com/r/IPython/comments/3lf81w/using_python35_in_ubuntu_trusty/
    Note:照这个方案安装python3.5后,很多系统程序用不了了。。因为系统程序用的3.4,所以只能还原系统python版本了:
    $ sudo rm /usr/bin/python3
    $ sudo mv /usr/bin/python3-old /usr/bin/python3
    $
    wget https://bootstrap.pypa.io/get-pip.py
    $ sudo python3 get-pip.py

    $ sudo python get-pip.py
    $ sudo pip3 install --upgrade ipython[all]
    $ sudo pip install --upgrade ipython[all]
    $ sudo rm -rf /usr/local/bin/ipython
    $ sudo ln -s /usr/local/bin/ipython2 /usr/local/bin/ipython
    # 验证:
    $ python --version
    $ python3 --version
    $ python3.5 --version
    $ pip --version
    $ pip3 --version
    $ ipython
    $ ipython3


    If you haven't already made the switch by installing from the source, and you want to install Python 3.5 system wide, you can use the following steps to upgrade to Python using the fkrull/deadsnakes ppa.

    Open a terminal window.

    • install Personal Package Archive: ppa:fkrull/deadsnakes
      • sudo add-apt-repository ppa:fkrull/deadsnakes
      • sudo apt-get update
    • install the following packages:
      • sudo apt-get install python3.5
      • sudo apt-get install python3.5-dev
      • sudo apt-get install libncurses5-dev
    • change python3 link to point to python3.5 instead of python3.4 (/usr/bin/)
      • sudo mv /usr/bin/python3 /usr/bin/python3-old
      • sudo ln -s /usr/bin/python3.5 /usr/bin/python3
    • install pip from https://pip.pypa.io/en/stable/installing/
    • install the following with pip3:
      • sudo pip3 install setuptools --upgrade
      • sudo pip3 install ipython[all]
    • change the python3 link back
      • sudo rm /usr/bin/python3
      • sudo mv /usr/bin/python3-old /usr/bin/python3
    • create python3.5 kernel
      • cp -R ~/.ipython/kernels/python3 ~/.ipython/kernels/python3.5
      • sed -i -- 's/3/3.5/g' ~/.ipython/kernels/python3.5/kernel.json

    After your done you can check by creating a Python 3.5 kernel Notebook and entering the following:

    import sys
    sys.version_info
    

    You should get the following response.

    sys.version_info(major=3, minor=5, micro=0, releaselevel='final', serial=0)
    

    *Edit: Reverted the default python3 to python3.4 but created a python3.5 kernel entry for the notebook. The reason for this is that changing the default python3 to python3.5 broke the apt-get updating process.

  • 相关阅读:
    好的软件架构设计(转)
    利用ManualResetEvent来来控制异步调用的打印的线程的暂停和恢复(转)
    Lucene.Net+盘古分词器(详细介绍)(转)
    如何让 height:100%; 起作用---父级元素必须设定高度
    前端问题汇总
    JS基础_强制类型转换-Number
    CSS实现垂直居中的常用方法
    vue项目上线步骤
    一篇文章全面了解运维监控知识体系
    vue+axios 前端实现登录拦截(路由拦截、http拦截)
  • 原文地址:https://www.cnblogs.com/xiaouisme/p/5483431.html
Copyright © 2011-2022 走看看