Setting up Python virtualenv: Difference between revisions

From HPCwiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 12: Line 12:
   (newenv)hjm@ubuntu:~$
   (newenv)hjm@ubuntu:~$
</code>
</code>
== installing modules on the virtual environment
Installing modules is the same as usual. The difference is that modules are in <code>/path/to/virtenv/lib</code>, which may be living somewhere on your home directory.
<source lang='bash'>
easy_install numpy
</source>
<source lang='bash'>
python setup.py install
</source>


== deactivating a virtual environment ==
== deactivating a virtual environment ==

Revision as of 22:34, 24 November 2013

creating a new virtual environment

virtualenv newenv

activating a virtual environment

source newenv/bin/activate

 (newenv)hjm@ubuntu:~$

== installing modules on the virtual environment Installing modules is the same as usual. The difference is that modules are in /path/to/virtenv/lib, which may be living somewhere on your home directory.

easy_install numpy
python setup.py install

deactivating a virtual environment

deactivate

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.

ln -s /path/to/virtenv/bin/ipython3 /path/to/virtenv/bin/ipython