我在一个终端窗口中运行 python 交互式会话,然后在另一个终端窗口中安装了 numpy。我怎么能import numpy
在运行的交互式会话中不退出并重新启动它?
问问题
120 次
1 回答
1
答案是你不应该做任何特别的事情。
% 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'>
于 2013-03-22T22:34:53.550 回答