Search code examples
pythonpython-2.7pipjython

Pip "install" Installs in Jython instead of python


I am trying to install "XLRD" library for python using PIP install, the library is installed successfully, after execution i tried to import the same but i get the error that no modules have been installed.

After some research i found that everything is getting installed in the C:jython/site-packages directory instead of C:/python27.

My pythonpath is set to C:/python27 , I checked.

What could be the issue? How do i instruct PIP to install modules in python directory.


Solution

  • On your terminal/command prompt navigate to the Python home directory of the version for which you need to install the module. Then navigate into the scripts folder and run the pip command. Like below

    cd C:/python27/Scripts
    pip install XLRD
    

    You basically need to point to the pip script for which you need to run this command. If thats for the pip script inside the python27, you need to navigate there or do like below as well

    C:/python27/Scripts/pip install XLRD
    

    If you have both the python27 & jython home directory & script paths in your 'PATH' environment variables, the path that was declared first takes precedence. To rearrange precedence, you would have to rearrange the order of the path declaration.