Reputation: 153311
I am running python interactive session in one terminal window, and then just installed numpy in another terminal window. How could I import numpy
in the running interactive session without exiting it and relaunching it?
Upvotes: 0
Views: 146
Reputation: 7755
The answer is that you shouldn't have to do anything special.
% virtualenv foo
New python executable in foo/bin/python
Installing setuptools............done.
Installing pip...............done.
% foo/bin/python
Python 2.7.3 (default, Sep 8 2012, 23:11:27)
[GCC 4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.60))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
>>>
Suspended
% foo/bin/pip install numpy
Downloading/unpacking numpy
% fg
>>> import numpy
>>> numpy
<module 'numpy' from '/.../foo/lib/python2.7/site-packages/numpy/__init__.pyc'>
Upvotes: 1