ubuntu 安装python,easy_install和pip
ubuntu12.04默认安装的python为
ms@ubuntums:~$ python
Python 2.7.3 (default, Aug 1 2012, 05:16:07)
我需要用python2.7.5,又找不到适合的升级的方法,只好安装python2.7.5
首先下载python源码:
1、下载Python 2.7.5源码:
wget http://www.python.org/ftp/python/2.7.2/Python-2.7.5.tgz
下载
2、解压源码包:
tar -zxvf Python-2.7.2.tgz
3、编译:
cd Python-2.7.2
./configure --prefix=/usr
4、make&&make install
安装完成后测试web界面可以正常打开了,但是使用yum安装软件的时候会发现不能使用,原因是yum与python有依赖关系,yum是急于python写的,运行yum命令时会调用pyton;
vi /usr/bin/yum
将#!/usr/bin/pyton 改成:#!/usr/bin/pyton2.6,改成你系统默认的版本即可,不然他会调用高版本的python软件包,但是是找不到的,需要做相关配置才行,这里为了方便就直接改了就可以使用了。
我安装的结果报错:
/usr/bin/install -c python /usr/bin/python2.7
/usr/bin/install: 无法删除"/usr/bin/python2.7": 权限不够
make: *** [altbininstall] 错误 1
ubuntu安装新python不要卸载旧版本的python,因为系统很多软件都依赖它。
我想原因应该是python2.7.3和Python2.7.5都已2.7开头,不能共存。
Ubuntu中安装多个版本Python
Ubuntu中默认就自带了python的2.5版本,结果我还是装了一个python的2.6版本,在网上查了下才知道python的2.5版本是目前使用者最多的版本,一些python的库都是用的这个版本,无奈只好再换回python的2.5版本了,其实在linux系统中多个python版本是可以共存的,只不过在终端中运行的时候,输入 python2.5 或者 python2.6就能进入不同的版本了,而且在你的*.py文件中可以用 #!/usr/bin/python 来指定程序的解释器版本,不过这样使用起来有些不方便,所以就把/usr/bin/python这个快捷方式的指向修改下好了。
: ~$ sudo rm /usr/bin/python
:~$ sudo ln -s /usr/include/python2.5 /usr/bin/python
这样在终端中输入python默认就是 2.5版本了。
很简单的,呵呵,我也是初学,这个没什么难度,就当个学习笔记吧
安装easy_install:
Unix-based Systems including Mac OS X
Download ez_setup.py and run it using the target Python version. The script will download the appropriate version and install it for you:
> wget https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py -O - | python
Note that you will may need to invoke the command with superuser privileges to install to the system Python.
Alternatively, on Python 2.6 and later, Setuptools may be installed to a user-local path:
> wget https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py
> python ez_setup.py --user
或者:
udo apt-get install python-setuptools 来安装
安装完后运行easy_install:
ms@ubuntums:~$ easy_install
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/test-easy-install-9879.pth'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python2.7/dist-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
http://packages.python.org/distribute/easy_install.html
这个错误不知怎么回事,好像是没有权限,我切换到root用户:
root@ubuntums:/home/ms# easy_install pip
ok。
安装Pip
从pip v1.5.1开始,安装变得很简单,直接以管理员身份,在get-pip.py所在的目录下运行
- python get-pip.py
执行完成后,在python的安装目录下的Scripts子目录下,可以看到pip.exe、pip2.7.exe、pip2.exe等,这就表示pip安装成功了。
注意:要想能在命令行上直接运行pip程序,需要scripts这个目录加入到环境变量PATH中。
pip安装的时候还可以使用安装选项进行安装,比如指定get-pip.py所在的位置:
- python get-pip.py --no-index --find-links=c:\downloads
【Usage】
Install a package from PyPI:
- pip install SomePackage
安装特定版本的package,通过使用==, >=, <=, >, <来指定一个版本号。
pip install 'Markdown<2.0'
pip install 'Markdown>2.0,<2.0.3
ubuntu 安装python,easy_install和pip的更多相关文章
- win8安装python环境和pip & easy_install工具
最近在学python,2.7.6的版本 首先安装python2.7 官网下载地址https://www.python.org/downloads/ 下载相应版本即可,应该是一个msi的文件,默认安装到 ...
- ubuntu安装python一些安装包
sudo apt-get install python-pip sudo pip install distribute sudo pip install nose sudo pip install v ...
- ubuntu安装Python环境以及科学计算环境
参考:http://blog.csdn.net/a1311543690/article/details/ 1.sudo apt-get install python-pip pip是Python的一个 ...
- Linux 下安装python软件包(pip、nose、virtualenv、distribute )
新手刚开始学习Python,目前学习<笨方法学python>ing- 在学习习题46时需要安装几个软件包:pip.nose.virtualenv.distribute !在此记录Linux ...
- Ubuntu安装Python机器学习包
1.安装pip $ mkdir ~/.pip $ vi ~/.pip/pip.conf [global] trusted-host=mirrors.aliyun.com index-url=http: ...
- 安装ubuntu系统及ubuntu安装Python的几点心得
一.安装ubuntu系统 1.ubuntu系统是Linux系统的一种,和centos差别不大,但是个人还是建议大家安装ubuntu,它更适合国内使用习惯,换句话说更亲切. 2.安装方法不再赘述,网上有 ...
- ubuntu安装python MySQLdb模块
本文讲述了python安装mysql-python的方法.分享给大家供大家参考,具体如下: ubuntu 系统下进行的操作 首先安装了pip工具 ? 1 sudo apt-get install py ...
- 在ubuntu安装python, theano, keras , Spearmint, Mongodb
系统配置: Ubuntu 14 (其他系统也差不多如下操作) 1. 通过anaconda安装 python 地址: https://www.continuum.io/downloads#linux 2 ...
- mac下安装Python的工具包pip
1. 在终端下输入 sudo easy_install pip password:输入电脑密码 Finished processing dependencies for pip 表示安装完成 boe ...
随机推荐
- XML中SystemID和PublicID的区别
http://hi.baidu.com/binboot007/item/1533f91d52113d7c7b5f259c http://supportweb.cs.bham.ac.uk/documen ...
- Android自定义控件(36篇)
http://blog.csdn.net/lmj623565791/article/details/44278417 http://download.csdn.net/user/lmj62356579 ...
- BZOJ 1058 报表统计 (STL)
题解:数据结构的基本操作,用STL可以完美实现,就是比较慢…… #include <cstdio> #include <map> #include <set> #i ...
- hdoj 1874 畅通工程续(单源最短路+dijkstra)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1874 思路分析:该问题给定一个无向图.起始点和终点,要求求出从起始点到终点的最短距离: 使用Dijks ...
- 字符串模式匹配KMP算法
一篇不错的博客:http://www.cnblogs.com/dolphin0520/archive/2011/08/24/2151846.html KMP字符串模式匹配通俗点说就是一种在一个字符串中 ...
- [置顶] Asp.Net底层原理(一、浏览器和服务器的交互原理)
…… 一.浏览器和服务器的交互原理 二.写自己的"迷你"Asp.net框架 三.Asp.Net的请求与响应过程 1.在此之前,首先简单的模拟一下我们去请求一个网址的时候,浏览器和服 ...
- Android 中文API (70) —— BluetoothDevice[蓝牙]
前言 本章内容是 android.bluetooth.BluetoothDevice,为Android蓝牙部分的章节翻译.蓝牙设备类,代表了蓝牙通讯国足中的远端设备.版本为 Android 2.3 ...
- 大一C语言结课设计之《简单计算器》
/*===============================================*\ ** 设计目的:简单计算器,计算形如10*(20.2-30.6)+5.0/2的表达式值 ** 简 ...
- if语句判断闰年、平年
一.让用户输入一个年份,判断是否是闰年. 判断一个年份是否是闰年有两个条件 ①能被400整除:②能被4整除但是不能被100整除 Console.WriteLine("请输入年份:" ...
- string.Format()字符串格式化
Format()基本语法: {索引[,对齐][:格式字符串]} ·索引:表示引用的对象列表中的第n个对象参数. ·对齐(可选):设置宽度与对齐方式,该参数为带符号的整数.正数为 ...