ubuntu 安装python,easy_install和pip
2013-07-19 00:30
661 查看
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:
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:
或者:
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。
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。
相关文章推荐
- ubuntu系统下,下载安装Python程序的方法汇总(wget;apt-get;easy_install;pip)
- Python3.6.X Windows下安装easy_install,pip3的方法
- centos6安装python3.5、pip3.5、easy_install-3.5
- python 安装easy_install和pip
- python下安装easy_install、pip遇到的问题
- python 安装easy_install和pip
- Windows安装Python、pip、easy_install
- python2.7无法使用pip(安装easy_install)
- python安装pip和easy_install
- Centos下安装pip,easy_install等python扩展库,centos下的
- 《Python网络编程》Part3 Win7系统下使用easy_install和pip安装python的包
- Windows下Python、Pydev、easy_install、pip、Numpy、Scipy安装
- Centos6.5 安装(更新)python3.5 和pip3.5,easy_install3.5问题
- 安装python的easy_install和pip
- python 安装easy_install和pip
- python-安装easy_install和pip(win64位)
- linux下,Python 多版本共存,及Pip,Easy_install 安装扩展包
- python2.7无法使用pip的解决方法(安装easy_install)
- python3.4学习笔记(十六) windows下面安装easy_install和pip教程
- centos安装python2.7,easy_install,pip