您的位置:首页 > 运维架构 > Linux

Install Python on Linux without Root Permission

2015-05-04 14:20 302 查看
You don't need root but you do need write privledges to a dir. This will
most likely be your homedir and so I use ~ in these docs. They're running redhat linux 6.2 on
intel.

Read the README doc in the root of the tarball for more detailed info.

Get python http://python.org (I used the lynx browser to get it)

Download Python-2.2.tgz to your homedir or somewhere like that and
extract to Python-2.2 with the commands:

tar zxf Python-2.2.tgz

cd Python-2.2

Next, type this command to configure options for your system

./configure

Normally you'd type 'make' in the root of Python-2.2 but if you run make
now you'll probably have some problems because this will attempt to
install everything in /usr/local/. These instructions are modified so
that python is installed into your home directory.

make altinstall prefix=~ exec-prefix=~

'prefix=~' installs all platform-independent files in ~/lib and
'exec-prefix=~' installs all binary and other platform-specific files in
~/bin

This installs the same set of files as "make install" except it doesn't
create the hard link to "python<version>" named "python" and it doesn't
install the manual page at all.

I create a link in ~/bin with

ln -s python2.2 python

And since my system has python 1.5.2 in /usr/bin, in my .bashrc I
short-circuit that with

alias python='~/bin/python'

hope this helps out some newbies.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux python