安装没有root的Python 2.7

时间:2022-04-06 20:23:41

I tried installing Python 2.7 without root on a remote linux machine. I ran the commands

我尝试在远程linux机器上安装没有root的Python 2.7。我跑了命令

./configure prefix=/  
make install DESTDIR=/xxx/yyy/ 

where /xxx/yyy/ is a directory for which I have read-write access.

其中/ xxx / yyy /是我具有读写访问权限的目录。

I ran into a problem at the end. It said:

我最后碰到了一个问题。它说:

building dbm using gdbm INFO: Can't locate Tcl/Tk libs and/or headers

使用gdbm INFO构建dbm:找不到Tcl / Tk库和/或头文件

Python build finished, but the necessary bits to build these modules were not found: _tkinter bsddb185 dl imageop sunaudiodev To find the necessary bits, look in setup.py in detect_modules() for the module's name.

Python构建完成,但找不到构建这些模块的必要位:_tkinter bsddb185 dl imageop sunaudiodev要查找必要的位,请在detect_modules()中的setup.py中查找模块的名称。

running build_scripts running install_lib creating /lib/python2.7 error: could not create '/lib/python2.7': Permission denied

运行build_scripts运行install_lib创建/lib/python2.7错误:无法创建'/lib/python2.7':权限被拒绝

Did I take the correct steps in installing it without root access? (i.e., my configure and make commands?) Can anyone tell me why it would not install properly?

我是否在没有root访问权限的情况下采取了正确的安装步骤? (即我的configure和make命令?)任何人都可以告诉我为什么它不能正确安装?

Thanks,
ktm

谢谢,ktm

4 个解决方案

#1


13  

I just install python2.7.5 without admin right. I think the command should be:

我只是在没有管理员权限的情况下安装python2.7.5。我认为命令应该是:

./configure prefix=/xxx/yyy
make install

and then you should add the path /xxx/yyy/bin in .bashrc as:

然后你应该在.bashrc中添加路径/ xxx / yyy / bin为:

PYTHONPATH=/home/songmeixu/python/bin
export PATH=$PYTHONPATH:$PATH

#2


8  

You should have prefix=/xxx/yyy. With prefix=/, it tries to install the libraries to /lib/python2.7, rather than /xxx/yyy/lib/python2.7.

你应该有前缀= / xxx / yyy。使用prefix = /,它会尝试将库安装到/lib/python2.7,而不是/xxx/yyy/lib/python2.7。

#3


4  

Don't compile, get the pre-built binary from ActiveState.

不编译,从ActiveState获取预构建的二进制文件。

#4


0  

Instead of building from source manually, I'd suggest letting linuxbrew do the build for you. DigitalOcean has a nice tutorial on installing linuxbrew. Once that's complete, you can just say brew install python and have a nicely managed python installation, including pip.

我建议不要手动构建源代码,而是让linuxbrew为你做构建。 DigitalOcean有一个很好的安装linuxbrew的教程。一旦完成,你可以说brew install python并有一个很好管理的python安装,包括pip。

#1


13  

I just install python2.7.5 without admin right. I think the command should be:

我只是在没有管理员权限的情况下安装python2.7.5。我认为命令应该是:

./configure prefix=/xxx/yyy
make install

and then you should add the path /xxx/yyy/bin in .bashrc as:

然后你应该在.bashrc中添加路径/ xxx / yyy / bin为:

PYTHONPATH=/home/songmeixu/python/bin
export PATH=$PYTHONPATH:$PATH

#2


8  

You should have prefix=/xxx/yyy. With prefix=/, it tries to install the libraries to /lib/python2.7, rather than /xxx/yyy/lib/python2.7.

你应该有前缀= / xxx / yyy。使用prefix = /,它会尝试将库安装到/lib/python2.7,而不是/xxx/yyy/lib/python2.7。

#3


4  

Don't compile, get the pre-built binary from ActiveState.

不编译,从ActiveState获取预构建的二进制文件。

#4


0  

Instead of building from source manually, I'd suggest letting linuxbrew do the build for you. DigitalOcean has a nice tutorial on installing linuxbrew. Once that's complete, you can just say brew install python and have a nicely managed python installation, including pip.

我建议不要手动构建源代码,而是让linuxbrew为你做构建。 DigitalOcean有一个很好的安装linuxbrew的教程。一旦完成,你可以说brew install python并有一个很好管理的python安装,包括pip。