Error Installing Python

2019-03-31 09:46发布

Upon hitting

make install

I get the following error

/usr/bin/install: cannot create regular file /usr/local/bin/python2.6: Permission denied make: *** [altbininstall] Error 1

I am not the root user so I assume its a permissions issue. I do have my own subfolder at /home/my_username Is there a way to complete the python installation there by giving a more specific command perhaps?

Also Python 2.4 is already installed how do I ensure that I am actually using 2.6?

Thanks alot!

1条回答
ら.Afraid
2楼-- · 2019-03-31 10:33

The configure script lets you specify --prefix=[dest]. From the usage:

By default, `make install' will install all the files in /usr/local/bin, /usr/local/lib etc. You can specify an installation prefix other than /usr/local using --prefix, for instance --prefix=$HOME.

So to install under py26 in your home directory:

% ./configure --prefix=$HOME/py26
..
% make install
% $HOME/py26/bin/python

To use this on a more permanent basis, add $HOME/bin to your PATH variable in your ~/.bashrc (or other shell rcfile). To verify which Python you're using, do this:

% which python
/home/user/py26/bin/python

Make sure you don't have a typo in the --prefix or the assignment to PATH. For example:

% which python
/usr/bin/python

% ls -1 $HOME/py26/bin/python*
/home/user/py26/bin/python
/home/user/py26/bin/python2.6
/home/user/py26/bin/python2.6-config
/home/user/py26/bin/python-config

% export PATH=$HOME/py26/bin:$PATH
% which python
/home/user/py26/bin/python
查看更多
登录 后发表回答