User Tools

Site Tools


Adding Python modules

If you want to use a Python module on Ponyland that is not yet availabe, please contact Wessel Stoop. Be warned, though, that it might take a few days before everything will be configured correctly. If you expect that your module will not be useful to other Ponyland users, please consider using virtualenv.

A quik introduction to virtualenv

Virtualenv is a program that allows you to create 'virtual Python environments'. Using virtualenv has two main advantages:

  • You no longer have to worry about version differences and dependencies. That is, if your script uses an older version of module x, and module x is updated system-wide, your script might break. If you build and use your script inside a virtualenv, virtualenv makes sure the right version of the right library is always available.
  • You no longer have to worry about permissions. Inside your virtualenv you're free to install any module you want.

To create an environment, simply type:

 $ virtualenv ENVNAME   

or with python3

 $ virtualenv -p python3 testvirtualenv

This will create a folder named ENV_NAME, which will include a special python interpreter and a place to store your modules. For Python 3 you can also go:

 $ python3 -m venv ENVNAME

To use your environment, type:

$ source ENVNAME/bin/activate

To stop using it, type:

$ deactivate

For more info see this page.

wiki/ponyland/python.txt · Last modified: 2017/03/16 09:57 by Wessel Stoop