试用一下PyPy
来源:互联网 发布:linux下的杀毒软件 编辑:程序博客网 时间:2024/04/30 12:49
Luo Weifeng 2011-8-28
最近,Pypy一度吸引了Python社区的眼球, 因为在完全兼容的前提下能将python性能提高好几倍,而且更节省内存, 这无疑是pythoner的福音啊。 为了不影响系统中的一些东西,推荐在vitrualenv中做个测试。
老外这篇文章介绍了 比较安全的试用pypy的方法, 使用vitrualenv 。
http://ch0wn.posterous.com/pypy-15-with-virtualenv-on-ubuntu-natty
PyPy 1.5 with virtualenv on Ubuntu Natty
PyPy 1.5 was released yesterday supporting all features of CPython 2.6 and CPython 2.7. So if you’re still doing Python 2 development, there is no excuse for not using it from now on. I’m going to explain how to do that on Ubuntu Natty.
Installing PyPy
Currently, there are no offical Ubuntu packages available on their official PPA. However, using the binary downloads in combination with the latest release of virtualenv will give you a comfortable environment.
All you need to do, is download the 32 bit or 64 bit version depending on your architecture and extract them wherever you want. Personally, I prefer a folder in my home directory.
Upgrading Virtualenv
Virtualenv 1.6.1 added PyPy 1.5 support. I created a PPA with an updated package. Execute these commands to get it:
sudo apt-add-repository ppa:passy/python
sudo apt-get update
sudo apt-get install python-virtualenv
If everything went right, virtualenv --version should now print 1.6.
Note: My virtualenv build lacks a debian-specific patch that uses distribute instead of setuptools by default. To enable the debian behavior, you can set the VIRTUALENV_USE_DISTRIBUTE environment variable in your .bashrc or pass —distribute whenever you create a new virtualenv.
Creating a virtualenv
To use PyPy instead of CPython, all you need to do is provide a path to the PyPy executable when creating a new virtualenv. In my case, PyPy is installed at /home/pascal/Applications/pypy-1.5 so the full command is
virtualenv -p /home/pascal/Applications/pypy-1.5/bin/pypy venv
If you’re using virtualenvwrapper there is no need to worry. The Ubuntu version will continue to work with the updated version of virtualenv.
Running a test
To verify your installation, I’m going to create a bare-bone django project and start the development server with PyPy.
cd /tmp
virtualenv --distribute -p /home/pascal/Applications/pypy-1.5/bin/pypy djangove
source djangove/bin/activate
pip install django
django-admin.py startproject testproject
cd testproject
pypy manage.py runserver
Now open a browser, navigate to http://localhost:8000 and enjoy your PyPy-powered django test page.
- 试用一下PyPy
- 试用一下
- 试用一下
- 试用一下blog
- 试用一下Windows LiveWriter
- 正式安装和试用一下
- Ubuntu 14.04小小试用一下
- 试用了一下osg的java绑定
- 刚申请了博客,试用一下
- 试用一下谷歌拼音,感觉不错
- 试用了一下kdiff3,感觉很不错。
- 试用了一下WPS2007,吐血了!
- .NET做的画图板,试用一下!
- 汇总一下CHROME日常试用工具
- PyPy 简介
- PyPy 简介
- 试试pypy
- pypy优点
- Web开发者必备的20款超赞jQuery插件
- Linux Epoll介绍和程序实例
- linux主要几种文件系统
- 九个让人难以置信的HTML5和JavaScript实验
- tomcat6.0+oracle10g数据源连接测试
- 试用一下PyPy
- 大道至简,职场上做人做事做管理
- char 类型指针与数组 赋值想到的
- 开源框架完美组合之Spring.NET + NHibernate + ASP.NET MVC + jQuery + easyUI 中英文双语言小型企业网站Demo
- [实验]用VTK给立方体贴纹理
- 现在开始学习jsp
- My secret Hobby: Applying for jobs
- 2011 年互联网十大浏览器
- 2011年必须看的20多个新鲜和实用的jQuery插件