install stackless python on ubuntu

前言

我准备用stackless模拟游戏玩家登陆/注册等行为,测试游戏服务器的性能。

但是在安装stackless的过程中遇到了很多问题,特此记录下来,也分享给需要的朋友。

关于stackless

Stackless Python is an experimental implementation of the Python language.

Stackless was designed from the start to overcome the limitations of cPython's Global Interpreter Lock by using tasklets, which implement functions as microthreads.

environment

(1) Ubuntu 12.04.5 LTS (GNU/Linux 3.5.0-23-generic x86_64)

(2) Python 2.7.3    [GCC 4.6.3] on linux2

Install

First install the required libraries and get stackless itself:

1 sudo apt-get install libreadline-dev
2 
3 cd /tmp
4 
5 wget http://www.stackless.com/binaries/stackless-273-export.tar.bz2
6 
7 bunzip2 stackless-273-export.tar.bz2
8 
9 tar xf stackless-273-export.tar

install stackless:

1 cd /tmp/stackless-273-export/
2 
3 ./configure --prefix=/opt/stackless --enable-unicode=ucs4
4 
5 make
6 
7 sudo make install

如果./configure 报错,首先检查是否已安装gcc,安装命令sudo apt-get install gcc

Now it's time to link your standard (CPython) packages so that they can be used with stackless:

1 sudo ln -s /usr/lib/python2.7/dist-packages/ /opt/stackless/lib/python2.7/dist-packages
2 
3 sudo ln -s /usr/local/lib/python2.7/dist-packages/ /opt/stackless/lib/python2.7/dist-packages
4 
5 sudo ln -s  /opt/stackless/bin/python /usr/bin/stackless

 edit the paths in the site.py file.

At about line 302, edit the file to look like this. It's the second site-packages.append bit we're adding here:

 1 sudo vi /opt/stackless/lib/python2.7/site.py
 2   
 3 line 302:
 4           elif os.sep == '/':
 5               sitepackages.append(os.path.join(prefix, "lib",
 6                                           "python" + sys.version[:3],
 7                                           "site-packages"))
 8               sitepackages.append(os.path.join(prefix, "lib",
 9                                           "python" + sys.version[:3],
10                                          "dist-packages"))
11              sitepackages.append(os.path.join(prefix, "lib", "site-python"))

That should be it! Let's test it:

check symbolic link

Install success.

 about stackless python

Introduction to Concurrent Programming with Stackless Python

english: (1) http://www.stackless.com/   

            (2) http://www.grant-olson.net/files/why_stackless.html     

            (3) https://bitbucket.org/stackless-dev

中文:http://gashero.yeax.com/?p=30  

posted @ 2015-05-21 14:58  开心星  阅读(692)  评论(0编辑  收藏  举报