python module imported from outside virtualenv

2019-08-07 06:31发布

问题:

I am running python from a USB drive using pycharm 3.4.1 as my IDE on win7. The path to my python interpreter is listed above. This python is within a virtualenv which I have activated:

$ source ../Scripts/activate                                                                                                                         
(r1)
f/envs/r1/masslist (master)
$

I just realized that when I import a module it is coming from a second python distribution on my drive:

F:\envs\r1\Scripts\python.exe -u F:\PyCharm 3.4.1\helpers\pydev\pydevconsole.py 53113 53114
PyDev console: starting.import sys; print('Python %s on %s' % (sys.version, sys.platform))
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
sys.path.extend(['F:\\envs\\r1\\masslist', 'F:\\PyCharm 3.4.1\\helpers\\pycharm', 'F:\\PyCharm 3.4.1\\helpers\\pydev'])
import django_manage_shell; django_manage_shell.run("F:/envs/r1/masslist")
>>> import webbrowser
>>> print webbrowser.__file__
f:\ppython275\App\Lib\webbrowser.pyc

What is happening here? How can I fix this and get the right module imported?