Setting up Python virtualenv: Difference between revisions

From HPCwiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
== creating a new virtual environment ==
<source lang='bash'>
<source lang='bash'>
virtualenv newenv
virtualenv newenv
</source>
</source>
== activating a virtual environment ==
<source lang='bash'>
<source lang='bash'>
source newenv/bin/activate
source newenv/bin/activate
Line 8: Line 12:
   (newenv)hjm@ubuntu:~$
   (newenv)hjm@ubuntu:~$
</code>
</code>
== deactivating a virtual environment ==
<source lang='bash'>
deactivate
</source>
=== Make IPython work under virtualenv ===   
=== Make IPython work under virtualenv ===   
source testenv/bin/activate
source testenv/bin/activate

Revision as of 21:29, 24 November 2013

creating a new virtual environment

<source lang='bash'> virtualenv newenv </source>

activating a virtual environment

<source lang='bash'> source newenv/bin/activate </source>

 (newenv)hjm@ubuntu:~$

deactivating a virtual environment

<source lang='bash'> deactivate </source>

Make IPython work under virtualenv

source testenv/bin/activate

   File "/usr/bin/ipython", line 11
   print "Could not start qtconsole. Please install ipython-qtconsole"
                                                                     ^

This can be resolved by adding a soft link with the name ipython to the bin directory in the virtual environment folder. <source lang='bash'> ln -s /path/to/virtenv/bin/ipython3 /path/to/virtenv/bin/ipython </source>