zoukankan      html  css  js  c++  java
  • Python之路【第一篇】:环境搭建

    虚拟机安装

    下载VMwareWorkstation以及centos,安装完VMwareWorkstation,创建一个虚拟机,然后在新创建的虚拟机上运行centos

    linux环境搭建

    公司开发使用linux的原因:稳定、安全、开源

    在虚拟机中使用centos这个版本,作为服务器端的centos与作为客户端的windows,两者进行通讯,需要SSH协议,需要在windows端安装xshell,centos自带openshell

    在linux中带有python,因此不需要下载python,查看python版本,并对python进行升级

    在终端环境下,打开python,出现的第一行即是版本号:

    [rh@localhost ~]$ python
    Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37) 
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 

    或者在终端输入python -V,也可以查看版本号:

    [rh@localhost ~]$ python -V
    Python 2.6.6

    对CentOS自带的python进行升级:

    1、安装gcc,用于编译Python源码
        yum install gcc
    2、下载源码包,wget https://www.python.org/ftp/python/3.5.4/Python-3.5.4.tar.xz
    3、解压并进入源码文件
    unxz Python-3.5.4.tar.xz
    tar xvf Python-3.5.4.tar
    cd Python-3.5.4v'i
    4、编译安装 ./configure make all make install 5、查看版本 /usr/local/bin/python3.5 -V 6、修改默认Python版本 mv /usr/bin/python /usr/bin/python2.6 ln -s /usr/local/bin/python3.5 /usr/bin/python 7、防止yum执行异常,修改yum使用的Python版本 vi /usr/bin/yum 将头部 #!/usr/bin/python 修改为 #!/usr/bin/python3.5
    至此,已经将python更新至3.5.4版本

    python环境搭建

    • python下载及安装
    • 环境变量修改

      登陆https://www.python.org进行python下载,并进行安装

      python2.7版本与python3.+版本可以同时安装在电脑上

    1、下载安装包
        https://www.python.org/downloads/
    2、安装
        默认安装路径:C:python27,可以自行修改
    在windows下如果要对python进行升级,卸载重装即可
    3、配置环境变量 【右键计算机】--》【属性】--》【高级系统设置】--》【高级】--》【环境变量】--》【在第二个内容框中找到 变量名为Path 的一行,双击】 --> 【Python安装目录追加到变值值中,用 ; 分割】 如:原来的值;C:python27,切记前面有分号
    三样东西有助于缓解生命的疲劳:希望、睡眠和微笑。---康德
  • 相关阅读:
    【leetcode】106. Construct Binary Tree from Inorder and Postorder Traversal
    【leetcode】105. Construct Binary Tree from Preorder and Inorder Traversal
    【leetcode】236. Lowest Common Ancestor of a Binary Tree
    【leetcode】235. Lowest Common Ancestor of a Binary Search Tree
    【leetcode】352. Data Stream as Disjoint Intervals
    【leetcode】897. Increasing Order Search Tree
    【leetcode】900. RLE Iterator
    BEC listen and translation exercise 26
    BEC listen and translation exercise 25
    BEC listen and translation exercise 24
  • 原文地址:https://www.cnblogs.com/ronghe/p/8176404.html
Copyright © 2011-2022 走看看