安装Python时发生错误 [英] Error Installing Python
问题描述
击中
make install
我收到以下错误
/usr/bin/install: cannot create regular file /usr/local/bin/python2.6: Permission denied make: *** [altbininstall] Error 1
我不是root用户,所以我认为它是权限问题.我在/home/my_username
处有自己的子文件夹,也许可以通过给出更具体的命令来完成python安装吗?
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?
还已经安装了Python 2.4,如何确保我实际上在使用2.6?
Also Python 2.4 is already installed how do I ensure that I am actually using 2.6?
非常感谢!
推荐答案
configure
脚本可让您指定--prefix=[dest]
.根据用法:
The configure
script lets you specify --prefix=[dest]
. From the usage:
默认情况下,"make install"将安装所有文件 /usr/local/bin,/usr/local/lib等.您可以指定 使用--prefix的/usr/local以外的安装前缀, 例如--prefix = $ HOME.
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.
因此要在主目录中的py26
下安装:
So to install under py26
in your home directory:
% ./configure --prefix=$HOME/py26
..
% make install
% $HOME/py26/bin/python
要更永久地使用它,请将$HOME/bin
添加到~/.bashrc
(或其他Shell rcfile)中的PATH
变量中.要验证您使用的是哪个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
确保在--prefix
或PATH
的作业中没有错字.例如:
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
这篇关于安装Python时发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!