我已经创建了一个虚拟环境,并在其中安装了SQLAlchemy:
我创建了一个虚拟环境,然后在里面安装了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
但是在中它无法运行:
>>> import sqlalchemy
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named sqlalchemy
为什么在执行了source alchemy/bin/activate
之后,bpython不能找到虚拟环境中安装的包?
bpython
。不再需要提供虚拟环境bin
目录的路径了。 - undefined