Python

From HPC

(Difference between revisions)
Jump to: navigation, search
(Managing packages with virtual environments)
(Managing packages with virtual environments)
Line 13: Line 13:
==Managing packages with virtual environments==
==Managing packages with virtual environments==
-
It is recommend to use Python Virtual Environments to create a clean space for your could where you can install any package combinations you need.
+
It is recommend to use Python Virtual Environments to create isolated Python environments  where you can install any package combinations you need without worrying about dependencies and versions, and indirectly permissions.
Please read [https://packaging.python.org/installing/#creating-virtual-environments | Creating Virtual Environments] for more information  
Please read [https://packaging.python.org/installing/#creating-virtual-environments | Creating Virtual Environments] for more information  
Line 19: Line 19:
The basic usage is like so:
The basic usage is like so:
-
Using virtualenv: (Python 2.6)
+
'''Using virtualenv: (Python 2.6)'''
-
virtualenv <DIR>
+
virtualenv <DIR>
-
source <DIR>/bin/activate
+
source <DIR>/bin/activate
-
Using venv: (Pyhton 3.5)
+
'''Using venv: (Pyhton 3.5)'''
-
python3.5 -m venv <DIR>
+
python3.5 -m venv <DIR>
-
source <DIR>/bin/activate
+
source <DIR>/bin/activate

Revision as of 12:02, 8 November 2016

Python

Version 2.7 and 3.5 are available on the HPC

Use the following executable binaries to start the correct version

python2
pip2
python3.5
pip3.5

Managing packages with virtual environments

It is recommend to use Python Virtual Environments to create isolated Python environments where you can install any package combinations you need without worrying about dependencies and versions, and indirectly permissions.

Please read | Creating Virtual Environments for more information

The basic usage is like so:

Using virtualenv: (Python 2.6)

virtualenv <DIR>
source <DIR>/bin/activate

Using venv: (Pyhton 3.5)

python3.5 -m venv <DIR>
source <DIR>/bin/activate
Personal tools