/Users/cheyu/VirtualENV/bin/python
['', '/Users/cheyu/VirtualENV/lib/python27.zip', '/Users/cheyu/VirtualENV/lib/python2.7', '/Users/cheyu/VirtualENV/lib/python2.7/plat-darwin', '/Users/cheyu/VirtualENV/lib/python2.7/plat-mac', '/Users/cheyu/VirtualENV/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/cheyu/VirtualENV/lib/python2.7/lib-tk', '/Users/cheyu/VirtualENV/lib/python2.7/lib-old', '/Users/cheyu/VirtualENV/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/cheyu/VirtualENV/lib/python2.7/site-packages']
(py36) ➜ proj source cobrapy/py36/bin/activate
(py36) ➜ proj python -c 'import cobra; print(cobra)'
<module 'cobra' from '/Users/henred/proj/cobrapy/py36/lib/python3.6/site-packages/cobra/__init__.py'>
xxxx:~ cheyu$ source VirtualENV/bin/activate
(VirtualENV) xxxx:~ cheyu$ python -c "import cobra; print cobra"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cobra.py", line 1, in <module>
ImportError: No module named test
(VirtualENV) xxxx:~ cheyu$ python -c "import pandas; print pandas"
<module 'pandas' from '/Users/cheyu/VirtualENV/lib/python2.7/site-packages/pandas/__init__.pyc'>
Then I tried "pip list", I found both cobra and pandas are in the activated virtual environment:
(VirtualENV) xxxx:~ cheyu$ pip list
cobra (0.8.1)
future (0.16.0)
mpmath (0.19)
numpy (1.13.1)
optlang (1.2.1)
pandas (0.20.3)
pip (9.0.1)
python-dateutil (2.6.1)
pytz (2017.2)
ruamel.ordereddict (0.4.13)
ruamel.yaml (0.14.12)
setuptools (36.2.7)
six (1.10.0)
swiglpk (1.4.3)
sympy (1.1.1)
tabulate (0.7.7)
wheel (0.29.0)
This is a clue:
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cobra.py", line 1, in <module>