下Linux下安装Python

1.在官网上下载Python的Linux源码包

2.解压源码包,在下载文件夹中解压就可以了,安装的时候系统会自动安装到默认的应用目录

3.在解压后的文件夹中执行 ./configure 命令







最后会提示生成了 MakeFIle文件

补: configure   命令执行完之后,会生成一个   Makefile   文件,这个   Makefile 主要是被下一步的   make   命令所使用。打开   Makefile 你就会发现,里边制定了构建的顺序,   Linux   需要按照 Makefile   所指定的顺序来构建   (build)   程序组件。

4.执行 make 命令,生成可执行文件


5.执行 make install  命令

make install 实际上是把生成的执行文件拷贝到   linux 系统中必要的目录下,比如拷贝到   /usr/local/bin   目录下,这样所有   user 就都能运行这个程序了。

以上2-5步骤,是安装源码包的一般步骤

cent os7上安装的时候遇到的问题:
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... linux2
checking EXTRAPLATDIR...
checking for --without-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/data/python/Python-2.7.8':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details


查了一下,发现有一种可能是没有安装gcc编译器,查看了一下本机
gcc -v
果然没有安装gcc编译器,所以先执行
yum install gcc 安装一下再去执行安装python

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值