Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
pyramid.pdf
Скачиваний:
10
Добавлен:
24.03.2015
Размер:
3.82 Mб
Скачать

2.2.INSTALLING PYRAMID ON A UNIX SYSTEM

2.1.2If You Don’t Yet Have A Python Interpreter (Windows)

If your Windows system doesn’t have a Python interpreter, you’ll need to install it by downloading a Python 2.6-series interpreter executable from python.org’s download section (the files labeled “Windows Installer”). Once you’ve downloaded it, double click on the executable and accept the defaults during the installation process. You may also need to download and install the Python for Windows extensions.

latex-warning.png

After you install Python on Windows, you may need to add the C:\Python26 directory to your environment’s Path in order to make it possible to invoke Python from a command prompt by typing python. To do so, right click My Computer, select Properties –>

Advanced Tab –> Environment Variables and add that directory to the end of the Path environment variable.

2.2 Installing Pyramid on a UNIX System

It is best practice to install Pyramid into a “virtual” Python environment in order to obtain isolation from any “system” packages you’ve got installed in your Python version. This can be done by using the virtualenv package. Using a virtualenv will also prevent Pyramid from globally installing versions of packages that are not compatible with your system Python.

To set up a virtualenv in which to install Pyramid, first ensure that setuptools is installed. Invoke import setuptools within the Python interpreter you’d like to run Pyramid under:

[chrism@vitaminf pyramid]$ python

Python 2.6.5 (r265:79063, Apr 29 2010, 00:31:32) [GCC 4.4.3] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import setuptools

If running import setuptools does not raise an ImportError, it means that setuptools is already installed into your Python interpreter. If import setuptools fails, you will need to install setuptools manually. Note that above we’re using a Python 2.6-series interpreter on Mac OS X; your output may differ if you’re using a later Python version or a different platform.

23

2. INSTALLING PYRAMID

If you are using a “system” Python (one installed by your OS distributor or a 3rd-party packager such as Fink or MacPorts), you can usually install the setuptools package by using your system’s package manager. If you cannot do this, or if you’re using a self-installed version of Python, you will need to install setuptools “by hand”. Installing setuptools “by hand” is always a reasonable thing to do, even if your package manager already has a pre-chewed version of setuptools for installation.

To install setuptools by hand, first download ez_setup.py then invoke it using the Python interpreter into which you want to install setuptools.

$ python ez_setup.py

Once this command is invoked, setuptools should be installed on your system. If the command fails due to permission errors, you may need to be the administrative user on your system to successfully invoke the script. To remediate this, you may need to do:

$ sudo python ez_setup.py

2.2.1 Installing the virtualenv Package

Once you’ve got setuptools installed, you should install the virtualenv package. To install the virtualenv package into your setuptools-enabled Python interpreter, use the easy_install command.

$ easy_install virtualenv

This command should succeed, and tell you that the virtualenv package is now installed. If it fails due to permission errors, you may need to install it as your system’s administrative user. For example:

$ sudo easy_install virtualenv

2.2.2 Creating the Virtual Python Environment

Once the virtualenv package is installed in your Python, you can then create a virtual environment. To do so, invoke the following:

$ virtualenv --no-site-packages env

New python executable in env/bin/python

Installing setuptools.............

done.

24

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]