Can't install mechanize in a virtual env

I am trying to use mechanize (http://wwwsearch.sourceforge.net/mechanize/)

I made a virtual env in python and I want to install mechanize in that virtual env

The project path is: F:\Shared\Projects\mkt>

The project Interpreter for this env is located at: F:\Anaconda\envs\dato-env\python.exe

When I try to install mechanize from the terminal in pycharm using >pip install mechanize , mechanize is installed but when i try to import mechanize in the console, it returns a traceback:

Traceback (most recent call last):
File "F:\Anaconda\envs\dato-env\lib\site-packages\IPython\core\interactiveshell.py", line 3035, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-8bf4bf743e9d>", line 1, in <module>
import mechanize as mnz
File "F:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: No module named mechanize

It seems mechanize was installed for another environment. When I run python from the console, the executable is not the one defined in the project interpreter for this project:

F:\Shared\Projects\mkt>python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'C:\\Program Files (x86)\\python27\\python.exe'

I have also tried to install it from File>settings>Project Interpreter>install , but mechanize does not appear on the Available Packages list.

How can I install Mechanize for use in my project? I'm running pycharm Community Edition 2016.1.2 in Windows 7

Please sign in to leave a comment.