安装 Python 时出错 [英] Error Installing Python
问题描述
点击后
进行安装
我收到以下错误
/usr/bin/install: 无法创建常规文件/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
中的 PATH
变量(或其他外壳 rcfile).要验证您使用的是哪个 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屋!