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)上是不工作的,以及提供一份解释不同之处的备选代码 ...
随机推荐
- Python 标准类库-并发执行之multiprocessing-基于进程的并行
实践环境 Python3.6 介绍 multiprocessing是一个支持使用类似于线程模块的API派生进程的包.该包同时提供本地和远程并发,通过使用子进程而不是线程,有效地避开了全局解释器锁.因此 ...
- hashtable分析
1.什么是Hash表? Hash表又被称为散列表,是根据关键码值(key-value)也就是键值对来直接访问的一种数据结构.也就是说,它通过把关键码值映射到表中的一个位置来访问记录,用以加快查找的 ...
- 【SpringBoot】条件装配 @profile
profile 使用说明: @profile注解的作用是指定类或方法在特定的 Profile 环境生效,任何@Component或@Configuration注解的类都可以使用@Profile注解. ...
- 现代C++(Modern C++)基本用法实践:零、概述&测试项目
序言 习惯上,我们把C++11之前的C++语法特性称之为"传统C++(traditional c++)",而把c++11之后的语法特性称之为现代C++(modern c++).有一 ...
- Redis 备忘录
redis是什么 Redis 是一个高性能的key-value数据库 常用操作 下载 官网:https://redis.io/ Linux版:https://redis.io/download Win ...
- SQL Server 内存占用较高 - 清除缓存 或 设置内存最大占用值
SQL Server对服务器内存的使用策略是用多少内存就占用多少内存,只用在服务器内存不足时,才会释放一点占用的内存,所以SQL Server 服务器内存往往会占用很高 查看内存状态: DBCC Me ...
- 解读 --- Span<T>
引言 Span<T> 是C# 中的一种结构体,它是一种内存安全的类型,可以用来表示连续的内存区域.Span<T> 可以被用于访问和操作数组.堆上分配的内存和栈上分配的内存.使用 ...
- 【算法】编写一个函数,返回两个正数的和,有可能超过ulong长度
编写一个函数,返回两个数字的和.输入数字是字符串,函数必须返回一个字符串. 示例: 添加("123","321"):->"444" 添 ...
- [docker]封装python的docker镜像
前言 基于alpine的python镜像封装. docker pull python:3.10-alpine 准备 requirements.txt内容: fastapi uvicorn server ...
- 压测工具sysbench的使用
前言 sysBench是一个模块化的.跨平台.多线程基准测试工具,主要用于评估测试各种不同系统参数下的数据库负载情况.sysbench提供如下测试: (1)CPU性能 (2)磁盘IO性能 (3)调度程 ...