How to Install Python on Linux
Summary
Hostmonster uses the preinstalled version of Python that ships with CentOS. Because of this it is often not the latest release. This article will explain how to install an updated version of python locally.
Download Python
Enter the following commands to download and extract Python 2.7 to your hosting account.
下载安装的过程基本在这里
1.建立一个文件夹保存下载的压缩包,进入之后下载;
2.然后解压缩
3.进入解压缩之后的文件夹准备安装
mkdir ~/python
cd ~/python
wget http://www.python.org/ftp/python/3.4.0/Python-3.4.0b1.tgz
tar zxfv Python-3.4.0b1.tgz
find ~/python -type d | xargs chmod 0755
cd Python-3.4
Install Python
Once extracted you can use the following commands to configure and install Python.
./configure --prefix=$HOME/python
make
make install
5.开始安装
Modify the .bashrc
For your local version of python to load you will need to add it to the .bashrc file.
vim ~/.bashrc
Press i ,than Enter:
export PATH=$HOME/python/bin:$PATH
Write the changes and close vim:
:wq
Press Enter
source ~/.bashrc
Note: You may need to logout for the environment to update.
Enter python -V to check the version of python installed.
6.设置环境变量。
【注意】 以上的操作都完成之后,但是由于linux原来就有一个版本的 python,这时候查看版本会发现,仍然是原来的版本,新的还是看不到。需要作如下操作。
1.再将原来/usr/bin/python链接改为别的名字
1 |
mv /usr/bin/python |
2.解压的新版的 python文件夹下,安装完成之后会有一个 /bin/python
把这个移动到原来链接位置(链接过去 ln)
再建立新版本python的链接
1 |
ln -s/bin/python2.7 |
3. 现在ok了,可以查询了。
python -V 可以看到信版本了
Python 3.4.0b1 (default, Jan 20 2014, 20:35:22)
[GCC 4.4.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
import 'atexit' # <class '_frozen_importlib.BuiltinImporter'>
# destroy atexit
>>>
http://www.python.org/ftp/python/3.4.0
Index of /ftp/python/3.4.0
How to Install Python on Linux的更多相关文章
- Django Python MySQL Linux 开发环境搭建
Django Python MySQL Linux 开发环境搭建 1.安装Python 进行Python开发,首先必须安装python,对于linux 或者Mac 用户,python已经预装. 在命令 ...
- 安装 Python IDLE (Linux)
Python IDLE (Integrated Development and Learning Environment) 是一个官方的轻量级 Python IDE.在不同的 Linux 的发布版本中 ...
- install Python 2.7 and Python 3.3 on CentOS 6
来自:http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/ In this guide I will show you ...
- 第6章:使用Python监控Linux系统
1.Python编写的监控工具 1).多功能系统资源统计工具dstat dstat是一个用Python编写的多功能系统资源统计工具,用来取代Linux下的vmstat,iostat,netstat和i ...
- install python+twisted+mysqldb+django on mac
一. install python 1) check install or not 在mac终端输入命令:which python 即可查看python的路径 2)未安装时,手动下载安装包 地址:ht ...
- python3 安装 #zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz RHEL 8 install Python 3 or Python 2 using yum 编译安装 python3.7.4 . OpenSSL 1.0.2 or 1.1. Consequently, OpenSSL 0.9.8 and 1.0
#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz Modules/Setup.dist https://askubuntu ...
- 再见Xshell、Xftp!Python执行Linux命令、上传下载远程文件
相信大家应该都接触过Linux操作系统(Ubuntu.Centos等),那么在使用的Linux操作系统需要使用一些远程ssh工具,尤其是公网服务器. 常用的ssh工具主要有:Xshell.MobaXt ...
- linux 部署python 系统服务管理命令 yum源设置 linux定时任务 python在linux的虚拟环境安装以及使用
安装python3 三种方式 ==linux下很多脚本默认都用python2, 所以不要把python3的执行文件改为python,因为linux里默认python就是运行python2版本 == y ...
- python实现Linux启动守护进程
python实现Linux启动守护进程 DaemonClass.py代码: #/usr/bin/env python # -*- coding: utf-8 -*- import sys import ...
- 使用Python获取Linux系统的各种信息
哪个Python版本? 当我提及Python,所指的就是CPython 2(准确的是2.7).我会显式提醒那些相同的代码在CPython 3 (3.3)上是不工作的,以及提供一份解释不同之处的备选代码 ...
随机推荐
- Prism进入视图时导航的三种方式
Prism导航 新建视图UserControl及其ViewModel,被跳转的视图的VM需要实现INavigationAware 在App.xaml.cs中注册视图及其ViewModel // App ...
- Blazor前后端框架Known-V1.2.2
V1.2.2 Known是基于C#和Blazor开发的前后端分离快速开发框架,开箱即用,跨平台,一处代码,多处运行. 概述 基于C#和Blazor实现的快速开发框架,前后端分离,开箱即用. 跨平台,单 ...
- 【Docker】迷你使用手册
一.安装与配置 安装: # Centos7 yum install docker 启动 & 设为开机启动: systemctl start docker.service systemctl e ...
- 如何有效检测、识别和管理 Terraform 配置漂移?
作者|Krishnadutt Panchagnula 翻译|Seal软件 链接|https://betterprogramming.pub/detecting-identifying-and-mana ...
- 利用InnoStep在VS编译时自动构建安装包
摘要 很多同学在C/S开发领域或多或少都可能会遇到需要制作安装包的场景,打包的工具也是五花八门,例如有NSIS.InstallShield.Wix Toolset.ClickOnce等等,这里以Inn ...
- 侯捷C++STL源码分析
STL六大部件 容器(Containers):放东西,需要占用内存. 分配器(Allocators):支持容器. 算法(Algorithms):操作容器里面的数据. 迭代器(Iterators):容器 ...
- 阿里如何实现秒级百万TPS?搜索离线大数据平台架构解读
★ 淘宝搜索阶段 在2008-2012这个阶段,我们重点支持淘宝搜索的业务发展,随着淘宝商品量的不断增加,逐步引入Hadoop.Hbase等开源大数据计算和存储框架,实现了搜索离线系统的分布式化,有力 ...
- 给C#新增一个时间类型: YearMonth
在.Net Framework中,我们常用的时间类型是DateTime.直到.Net6微软加入了两个新的时间类型:DateOnly和TimeOnly,才弥补了之前的不足. DateOnly:表示仅日期 ...
- wireshark 怎么过滤字符串 和 复制data中的可读文本
设置 首先点击,[捕获]下面的小放大镜 选择 分组字节流 - 窄(UTF-8/ASCII)- 字符串 (注意,要向选择字符串) 效果 复制报文中的可读数据 右键报文,复制,...as Printabl ...
- 园子的商业化努力-阿里云开发者社区合作:RDS MySQL Serverless 免费试用活动
阿里云开发者社区这个月组织了一个针对"云数据库 RDS MySQL Serverless 版"免费试用用户的做任务活动,上周找园子合作,希望能在园子里推广一下这个活动. 由于时间太 ...