Python环境搭建

Python安装

windows:

1
2
3
4
5
6
7
1 、下载安装包
     https: / / www.python.org / downloads /
2 、安装
     安装路径:D:\python36
3 、配置环境变量
     【右键计算机】 - - 》【属性】 - - 》【高级系统设置】 - - 》【高级】 - - 》【环境变量】 - - 》【在第二个内容框中找到 变量名为Path 的一行,双击】 - - > 【Python安装目录追加到变值值中,用 ; 分割】

    如:原来的值;C:\python27,切记前面有分号


1277635-20171223210616225-1589155698.png


Python更新

windows:

    1.卸载重装即可

linux:


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





猜你喜欢

转载自blog.51cto.com/11392572/2104289