简体   繁体   中英

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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM