freebsd下之简单安装python

先su到root帐户

进入/usr/ports/lang/python26

然后直接make

 

freebsd下之简单安装python_第1张图片

freebsd下之简单安装python_第2张图片

 

freebsd下之简单安装python_第3张图片

 

整个过程如图所示,经过漫长的编译之后...

然后make install

又是漫长的等待...

 

出现Install them as needed.
====
--------------------------------------------------------
This package was built with the experimental POSIX
semaphore support. Please ensure that the kernel on the
system where you deploy this package is either compiled
with 'option P1003_1B_SEMAPHORES', or has the sem.ko
kernel module loaded.
--------------------------------------------------------
===>   Compressing manual pages for python26-2.6.1_2
===>   Running ldconfig
/sbin/ldconfig -m /usr/local/lib
===>   Registering installation for python26-2.6.1_2
hwt#

 

恭喜,安装成功

 然后输入hwt# python

进入如下python开发环境
Python 2.5.4 (r254:67916, Apr 13 2009, 18:09:11)
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd7
Type "help", "copyright", "credits" or "license" for more information.
>>>

 

输入print 'hello money'

出现

>>> print 'hello money'
hello money
>>>

恭喜,第一个python程序出来了

 

不需要第三个变量来交换两个输入值

>>> a,b=1,2
>>> a,b=b,a
>>> a,b
(2, 1)
>>>

 

你可能感兴趣的:(FreeBSD)