problem:
In the computer terminal and can properly installed pyquery introduced, but not import pycharm, suggesting the absence of the module. Install the following error in pycharm setting in:
AttributeError: module 'pip' has no attribute 'main'
Cause: The current version pip no main (), without downgrading the solution is as follows:
Find pycharm installation directory helpers / packaging_tool.py file, locate the following code:
# From the line 104 begins DEF do_install (the pkgs): the try : Import PIP the except ImportError: error_no_pip() return pip.main(['install'] + pkgs) def do_uninstall(pkgs): try: import pip except ImportError: error_no_pip() return pip.main(['uninstall', '-y'] + pkgs)
Modify the following code:
def do_install(pkgs): try: # import pip try: from pip._internal import main except Exception: from pip import main except ImportError: error_no_pip() return main(['install'] + pkgs) def do_uninstall(pkgs): try: # import pip try: from pip._internal import main except Exception: from pip import main except ImportError: error_no_pip() return main(['uninstall', '-y'] + pkgs)
Method Two: downgraded version pip
python -m pip install --upgrade pip==9.0.3