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)上是不工作的,以及提供一份解释不同之处的备选代码 ...
随机推荐
- 龙芯电脑编译redis (loongarch)
1.获取源码 源码地址:https://redis.io/download/#redis-downloads 最新版本是7.2,这里用redis5测试,最后一个版本是5.0.14 wget https ...
- 暗黑2能用Java开发?还能生成APP?
最近烧哥发现个宝藏项目,竟然用Java开发了暗黑2出来. 众所周知,暗黑2是暴雪开发的一款经典游戏,距今虽有20多年,仍然有很多粉丝. 粉丝延续热情的方式有很多,一种是做Mod,比如魔电,对怪物.技能 ...
- Day11_Java_作业
1:递归那个兔子对数练习题 有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问第二十个月的兔子对数为多少?(使用递归去解决) 2:定义一个数组 ...
- C语言基础--字符串
文章目录 前言 一.数组 1.一维数组的创建 2.数组的索引 3.数组的调用 3.1 单个输出 3.2多个输出 二.字符串的创建 1.字符串的创建 2.字符串的输出 三.总结 前言 C语言中,有整型. ...
- Avalonia 使用EFCore调用SQLite实现Singleton全局注册
Avalonia 使用EFCore调用SQLite实现Singleton全局注册 本篇博客是我的开源项目TerraMours.Chat.Ava的更新的记录分享,本次更新使用EntityFrameWor ...
- 介绍一个简易的MAUI安卓打包工具
介绍一个简易的MAUI安卓打包工具 它可以帮助进行MAUI安卓的打包. 虽然也是用MAUI写的,但是只考虑了Windows版本,mac还不太会. 没什么高级的功能,甚至很简陋,它能做的,只是节省你从M ...
- React中setState的使用与同步异步
在react中,修改状态如果直接使用this.state,不会引起组件的重新渲染,需要通过 this.setState来对组件的属性进行修改. 1.this.setState的两种定义方式 定义初始状 ...
- markdown之mermaid
官方文档 01 简单的流程图 TD或TB:top to bottom,从上到下的流程图 LR:从左到右 其它:RL,BT flowchart LR; A([节点A的圆矩框]) --> |AB之间 ...
- C#的重载决策
重载是许多编程语言支持的特性.所谓重载,就是指可以定义多个名称相同但参数(个数.类型和顺序)不同的方法(函数).先来看一个例子: void Main() { char cvalue = 'a'; ma ...
- Jmeter:"An error occurred: Can't connect to X11 window server using 'lacalhost:12.0' as the value of the display variable." 解决办法
做各种不同项目的性能测试,都需要在项目本地压测服务器配置jmeter,需要时还要调出jmeter图形化界面来调试jmeter脚本. 标题中的问题遇过多次,这次做个记录. 1. 启动jmeter报错 在 ...