目录 http://see.sl088.com/wiki/Python_%E7%BC%96%E8%AF%91%E5%AE%89%E8%A3%85
[隐藏]
1更多研究
2好处
3有趣
3.1可重复编译
4困扰
5经验
5.1Centos5 编译安装Python2.7
6音频想法
更多研究
Python 编译安装/库安装Python 编译安装/缺少模块
好处
它不如yum等安装工具的安装,不会破坏原来系统的关联(通常不会)
它的安装只是将文件放置于恰当的位置
有趣
可重复编译
看起来你随便编译几次都随你
困扰
如何卸载源码安装呢?
可能卸载源码安装吗?
经验
Centos5 编译安装Python2.7
获得python2.7.4
wget http://www.python.org/ftp/python/2.7.4/Python-2.7.4.tgz
[root@li84-236 app]# wget http://www.python.org/ftp/python/2.7.4/Python-2.7.4.tgz--2013-10-08 18:13:36-- http://www.python.org/ftp/python/2.7.4/Python-2.7.4.tgzResolving www.python.org... 82.94.164.162, 2001:888:2000:d::a2Connecting to www.python.org|82.94.164.162|:80... connected.HTTP request sent, awaiting response...200OKLength:14489063(14M)[application/x-tar]Saving to:`Python-2.7.4.tgz'100%[==============================================================================>] 14,489,063 1.09M/s in 13s2013-10-08 18:13:54 (1.10 MB/s) - `Python-2.7.4.tgz.1'saved[14489063/14489063]
解压
tar zxvf Python-2.7.4.tgz
进入目录咯 cd Python-2.7.4
[root@li84-236 app]# cd Python-2.7.4[root@li84-236 Python-2.7.4]# lsbuild configure Include Mac Modules pyconfig.h READMEconfig.guess configure.ac install-sh Makefile Objects pyconfig.h.in RISCOSconfig.log Demo Lib Makefile.pre Parser python setup.pyconfig.status Doc libpython2.7.a Makefile.pre.in PC Python Toolsconfig.sub Grammar LICENSE Misc PCbuild python-gdb.py
初始化编译配置啥子的
./configure
这玩意检查了一大串的东西
编译,以及安装
sudo make && make install
这里用&&看起来是make成功后再执行后面的
它很可能以这里结束
...running install_scriptscopying build/scripts-2.7/idle -> /usr/local/bincopying build/scripts-2.7/smtpd.py -> /usr/local/bincopying build/scripts-2.7/2to3 -> /usr/local/bincopying build/scripts-2.7/pydoc -> /usr/local/binchanging mode of /usr/local/bin/idle to 755changing mode of /usr/local/bin/smtpd.py to 755changing mode of /usr/local/bin/2to3 to 755changing mode of /usr/local/bin/pydoc to 755running install_egg_infoWriting /usr/local/lib/python2.7/lib-dynload/Python-2.7.4-py2.7.egg-infoiftest-f /usr/local/bin/python -o -h /usr/local/bin/python;\thenrm -f /usr/local/bin/python;\elsetrue;\fi(cd/usr/local/bin;ln -s python2 python)rm -f /usr/local/bin/python2(cd/usr/local/bin;ln -s python2.7 python2)rm -f /usr/local/bin/python2-config(cd/usr/local/bin;ln -s python2.7-config python2-config)rm -f /usr/local/bin/python-config(cd/usr/local/bin;ln -s python2-config python-config)test-d /usr/local/lib/pkgconfig||/usr/bin/install -c -d -m755/usr/local/lib/pkgconfigrm -f /usr/local/lib/pkgconfig/python2.pc(cd/usr/local/lib/pkgconfig;ln -s python-2.7.pc python2.pc)rm -f /usr/local/lib/pkgconfig/python.pc(cd/usr/local/lib/pkgconfig;ln -s python2.pc python.pc)rm -f /usr/local/share/man/man1/python2.1(cd/usr/local/share/man/man1;ln -s python2.7.1 python2.1)rm -f /usr/local/share/man/man1/python.1(cd/usr/local/share/man/man1;ln -s python2.1 python.1)[root@li84-236 Python-2.7.4]#
到这里编译安装就完成了
安装后的位置
[root@li84-236 Python-2.7.4]# /usr/local/bin/python2.7Python 2.7.4(default, Oct82013, 18:17:44)[GCC 4.1.220080704(Red Hat 4.1.2-54)]on linux2Type"help","copyright","credits"or"license"formore information.>>>
Linux下is not in the sudoers file解决方法
当我们使用sudo命令切换用户的时候可能会遇到提示以下错误:xxx is not in the sudoers file. This incident will be reported,xxx是你当前的用户名,究其原因是用户没有加入到sudo的配置文件里
工具/原料
vi/vim
方法/步骤
切换到root用户,运行visudo命令
2
在打开的配置文件中,找到root ALL=(ALL) ALL,在下面添加一行
xxx ALL=(ALL) ALL 其中xxx是你要加入的用户名称
3
输入:wq保存并退出配置文件,再次使用sudo命令就不会有上面的提示了。
sudo:can't open /etc/sudoers: Permission denied 解决方法:chmod -R 0440 /etc/sudoers.d 或 chmod u-w /etc/sudoers
sudo lsattr /etc/sudoers
看有没有 i 属性
假如有 sudo chattr -i /etc/sudoers