2010年10月22日 星期五 17:08
Working on the Bleeding Edge
工作在危险边缘
If you want to use the development version of Pylons -- or even contribute to Pylons development yourself -- you can install the bleeding-edge latest directly from the Pylons Mercurial repository.
如果你想使用开发版本的Pylons --甚至想对Pylons本身的开发作出一些贡献--你可以直接从Pylons Mercurial repository获取安装最新的开发版本。
Mercurial is a popular open-source revision control system written in Python which many projects including Pylons are choosing instead of Subversion because of its distributed nature and more powerful feature set. Mercurial is documented in detail in the Mercurial Book at http://hgbook.red-bean.com/hgbook.html but if you just want to get started quickly you will find this guide on the Pylons wiki very useful: http://wiki.pylonshq.com/display/pylonscookbook/Mercurial+for+Subversion+Users
Mercurial是一种颇受欢迎的开放源码的版本控制系统,是Python编写的。许多项目,包括Pylons,选择它,而不是Subversion,因为它发布的特性和更强大的功能集。在 http://hgbook.red-bean.com/hgbook.html 的Mercurial书中,详细介绍了Mercurial,但如果你只是想快速入门,你会发现在Pylons wiki上的这个指南非常有用: http://wiki.pylonshq.com/display/pylonscookbook/Mercurial+for+Subversion+Users
Once Mercurial is installed you will need to clone the development versions of Pylons and all its dependencies. It can be quite a time-consuming process to track down all the repositories and clone the source files so the Pylons developers created a go-pylons.py script to set up a virtual Python environment and automate the process.
Mercurial安装后,你就可以克隆(clone) Pylons的开发版本及其所有依赖。这是相当耗时的过程,追踪所有的库,并克隆源文件,因此Pylons的开发者编写了一个go-pylons.py脚本来建立一个虚拟的Python环境和自动化这个过程。
Download the program for Pylons 0.9.7 from
http://www.pylonshq.com/download/0.9
.7/go-pylons.py and then run this command:
从 http://www.pylonshq.com/download/0.9.7/go-pylons.py 下载这个程序,然后运行下面的命令安装Pylons 0.9.7:
python go-pylons.py --no-site-packages devenv
The script whirrs away and sets up a development virtual Python environment. Mac OS X developers will need the Apple developer tools distributed with XCode or the iPhone SDK. You can download either for free from http://developer.apple.com/technology/xcode.html but you will need to register.
该脚本运行和建立了一个虚拟的Python的开发环境。Mac OS X的开发者将需要发行的Apple开发工具XCode或iPhone SDK。从
http://developer.apple
.
com/technology/xcode.html,你可以免费下载到每一个,但是需要注册。
Caution!
While the Pylons development team always try to ensure the code in the Pylons trunk is functioning and up to date there is no guarantee it will be stable. If you choose to use the development version instead of the official release you should be aware that Pylons may not behave as you expect and is more likely to contain some bugs as new features are introduced.
注意!
虽然Pylons的开发团队总是试图确保在Pylons分支的代码能够运作和保持最新,也不能保证这将是稳定的。如果你选择使用开发版本,而不是官方发布,你需要知道,Pylons可能不会像你期望运作,更可能由于新功能的添加包含了一些错误。
Platform Specific Notes
平台的具体说明
Pylons itself works with all versions of Python since 2.3 but it is recommended that you use Python 2.4 or above because some of the third party packages which you are likely to use when developing a Pylons application are less likely to support the older versions. Python 2.5 or 2.6 are ideal.
Pylons可以在Python 2.3以后的所有版本上工作,但建议你使用Python 2.4或以上,因为开发一个Pylons的应用时,你有可能使用的一些第三方的软件包,不太可能支持旧版本。Python 2.5或2.6是理想的选择。
The following sections describe how to install Python on Linux/BSD, Windows and Mac OS X platforms. They also go into some detail about other tools and software you are likely to need on your platform as well as any extra steps you need to take or platform-specific issues you need to be aware of.
以下各节介绍如何在各个平台上安装Python,包括Linux / BSD,Windows和Mac OS X。它们还将涉及到一些在你的平台上你可能需要的其他工具和软件详细介绍,以及你需要考虑的所有额外的步骤或你需要了解的平台的具体问题。
Note
Python supports the use of C or C++ extensions to facilitate integration with other libraries or to speed up certain sections of code. Although you are unlikely to ever need to write your own extensions when developing a Pylons application you may find some third party packages, particularly database drivers, do contain extensions.
Unlike pure Python packages, packages containing extensions need to be compiled for each platform on which they are run. Most of the time a binary version of a particular package will already exist for your platform (particularly if you run Windows) but if not the extension may need to be compiled. The compilation step will happen automatically but in order for it to work you will need a suitable development environment set up. The installation sections for Linux/BSD and Mac OS X platforms will describe how to do this.
注意:
Python 支持使用 C 或 C++ 扩展,以促进与其他库的整合,或提升某些部分的代码的性能。当你开发一个 Pylons 的应用时,你不可能任何时候都需要自己写扩展,这时你可能会发现一些第三方软件包,尤其是数据库的驱动程序,可以作为某方面的扩展。
不同于纯粹的 Python 软件包,这些软件包扩展需要在它们所运行的特定平台上编译。大多数时候,特定平台的二进制版本的软件包已经存在(特别是如果你运行 Windows ),但如果没有,则需要编译。编译步骤将自动运行,但为了使它工作,你需要一个合适的开发环境设置。 Linux / BSD 和 Mac OS X 的安装部分将说明如何做到这一点。
Linux and BSD
Most modern Linux and BSD platforms include Python as part of their standard installation. You can find out which version of Python you have on your platform by typing python at a prompt and reading the information which is displayed. If the python command loads an old version of Python you might find that the commands python2.5 or python2.4 load more recent versions.
最现代的Linux和BSD平台将Python作为其标准安装的一部分。通过在命令提示符后输入python,读取显示的信息,你可以找出你的平台上安装的Python版本。如果python命令加载旧版本的Python,你可能会发现命令python2.5或python2.4负载更多的最新版本。
If your platform doesn't have a recent version of Python you will need to install a binary version in whichever way is appropriate for your platform. For example, on Debian you would use the apt-get command, on Fedora or RedHat you would use RPM and on FreeBSD you would use the package system.
如果你的平台没有一个最近的Python版本,你将需要以适合你的平台的方式安装一个二进制版本。例如,在Debian你可以使用apt - get命令,在Fedora或RedHat你可以使用RPM,在FreeBSD你可以使用软件包管理系统。
Compiling Python directly from source is also straightforward and you're free to do so if you prefer. First download the source distribution from http://www.python.org/download/source/ and then extract all the files. One of the extracted files is a README file which includes build instructions for various platforms. You should follow the instructions for your particular platform.
直接从源编译Python也是简单明了的,你完全可以这样做,如果你喜欢的话。首先从 http://www.python.org/download/source/ 下载源分布,然后提取所有文件。提取文件其中有一个自述文件(README),其中包括各种平台的build指示。你应该遵照你所在平台的指示。
If you wish to be able to compile Python packages with C or C++ extensions you will also need to install a build environment which includes the same version of GCC as the Python and its dependencies were compiled with. Some platforms also require you to install a python-dev package as well.
如果你希望能够编译带有C或C++扩展的Python软件包,你还需要安装一个编译(build)环境,其中包括与Python及其依赖编译所使用的版本一致的GCC。在一些平台,你还需要安装一个python-dev软件包。
For example, to set up Debian 4.0 to be able to compile Python extensions you would need to install these development packages:
例如,设置Debian 4.0,使之能够编译Python扩展,你需要安装这些开发包:
$ sudo apt-get install python-dev libc6-dev
Sometimes particular packages need to be compiled with a version of gcc older than the default on the platform. On Debian you can install gcc 2.95 with this command:
有时候,某些包需要使用低于平台默认的gcc版本编译。在Debian可以用这个命令安装gcc 2.95:
$ sudo apt-get install gcc-2.95
To use this older version you would set the CC environment variable before trying to build a package. The way you do this depends on your shell but for Bash you would run this command:
若要使用此旧版本,在试图build一个软件包前,你需要设置CC环境变量。这取决于你的shell,在Bash下,你可以运行此命令:
$ export CC=/usr/bin/gcc-2.95
Once the required version of gcc has been setup EasyInstall should be able to automatically compile any dependencies from the same shell. If you need to open another shell you will need to check the CC variable is still set and set it again if necessary:
一旦需要的gcc版本已经安装,在同一shell下,EasyInstall能够自动编译所有的依赖。如果你需要打开另一个shell,你将需要检查CC变量是否保持设置,如果必要的话,重新设置一下:
$ echo $CC
/usr/bin/gcc-2.95
Mac OS X
Python 2.5 comes pre-installed on Mac OS X Leopard complete with EasyInstall so Leopard users can get started creating a virtual Python environment and installing Pylons straight away.
Python 2.5预安装在Mac OS X Leopard,包含EasyInstall,因此,用户可以直接开始建立一个虚拟的Python环境和安装Pylons。
Older versions of Mac OS X also include Python but the version included is sometimes either one or two years old because of Apple's release cycle. The overwhelming recommendation of the "MacPython" community is to upgrade your Python by downloading and installing a newer version.
旧版本的Mac OS X也包括Python,但由于苹果的发布周期,版本有时是一两年前的。“MacPython”社区的绝大多数的建议是通过下载安装更新的版本来升级你的Python。
Older versions of Mac OS X are also supported. Visit
http://www.python.org/
download/mac/ for more details.
旧版本的Mac OS X也被支持。访问
http://www.python.org/download/mac/
了解更多详情。
Caution!
It is worth being aware that if you install packages to /Library/Python/2.5/site-packages and then use virtualenv to install Pylons to a local directory, any applications you run from the local directory won't be able to find those in the /Library/... path so it is always best to install everything locally.
If you encounter this problem you can fix it by running EasyInstall from your virtualenv for each of the packages which appear to be missing. EasyInstall will then find them and add them to the virtualenv easy-install.pth file.
注意!
值得注意的是,如果你安装软件包到 /Library/Python/2.5/site-packages ,然后使用 virtualenv 安装 Pylons 到本地目录,任何从本地目录运行的应用程序将无法找到那些在 /Library/... 路径的软件包,因此最好一直把所有的安装本地化。
如果你遇到此问题,你可以修复它,通过从你的 virtualenv 运行 EasyInstall 安装每个丢失的软件包。 EasyInstall 然后将找到它们并将它们添加到 virtualenv 中的 install.pth 文件。
原文: http://hi.baidu.com/zhuifengdenanhai/blog/item/ae0baac230018a1c0ef477a1.html
Zeuux © 2024
京ICP备05028076号