我创建了一个 virtualenv 并在其中安装了SQLAlchemy:
$ virtualenv alchemy
$ source alchemy/bin/activate
$ pip install sqlalchemy
import
在python中工作:
$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlalchemy
>>> print sqlalchemy.__version__
0.9.7
但它在bpython中不起作用:
>>> import sqlalchemy
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named sqlalchemy
为什么bpython找不到安装在virtualenv中的包,即使它是在source alchemy/bin/activate
调用之后执行的?