User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

wiki:ponyland:python [2019/04/25 15:23] (current)
Line 1: Line 1:
 +====== Adding Python modules ======
 +If you want to use a Python module on Ponyland that is not yet availabe, please contact [[wiki:​ponyland:​admin]]. 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 [[https://​​pypi/​virtualenv|this page]].
wiki/ponyland/python.txt ยท Last modified: 2019/04/25 15:23 (external edit)