SebMa
SebMa

Reputation: 4717

Python pip2 installs packages in /usr/local/lib/pypy2.7/

On LINUX, I have a python2 script that needs 5 python modules to be installed.

So I run : sudo -H pip2 install ipython numpy pandas scipy termcolor

but instead of installing the python modules in /usr/local/lib/python2.7/ that got installed in /usr/local/lib/pypy2.7/

Therefore, If I run the script needing these 5 modules, it says :

Traceback (most recent call last):
  File "./toto.py", line 23, in <module>
    import pandas #pour importer les data
ImportError: No module named pandas

Can you please help me ?

EDIT : Added a few information

$ which pip2
/usr/local/bin/pip2
$ pip2 -V
pip 9.0.1 from /usr/local/lib/pypy2.7/dist-packages (python 2.7)

Upvotes: 0

Views: 209

Answers (1)

Aleksandr Borisov
Aleksandr Borisov

Reputation: 2212

It means the pip2 script you run is from your pypy installation (environment). You can check it by running pip2 --version which will show you its path.

To install packages to another environment you need either specify full path to pip (like sudo /usr/local/lib/python2.7/bin/pip ...) or, better, modify you PATH environment (see echo $PATH) so that python2 will precede pypy.

Upvotes: 1

Related Questions