Why can't import pandas after successful installation?

I installed pandas with the command 'pip3.4 install pandas'.

Successfully installed pandas python-dateutil pytz numpy six
Cleaning up...

root@hwy:~# python3.4
Python 3.4.2 (default, Oct  8 2014, 10:45:20) 
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'pandas'

Why can't import pandas in python3.4 after installing pandas successfully?

root@hwy:/home/debian8# pip3.4 show pandas
---
Name: pandas
Version: 0.17.1
Location: /usr/local/python3.4/lib/python3.4/site-packages
Requires: python-dateutil, pytz, numpy
root@hwy:/home/debian8# echo "import sys; print sys.path"
import sys; print sys.path
root@hwy:/home/debian8# python3.4
Python 3.4.2 (default, Oct  8 2014, 10:45:20) 
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.path)
['', '/usr/lib/python3.4', '/usr/lib/python3.4/plat-x86_64-linux-gnu',
 '/usr/lib/python3.4/lib-dynload', '/usr/local/lib/python3.4/dist-packages',
 '/usr/lib/python3/dist-packages']
+4
source share
1 answer

Your pandasinstalled here:

/usr/local/python3.4/lib/python3.4/site-packages

But this way is not in sys.path.

As a workaround:

export PYTHONPATH=$PYTHONPATH:/usr/local/python3.4/lib/python3.4/site-packages

and inside this terminal, start Python again and do your import pandas.

If this works, add this line above ( export PYTHONPATH...) to yours ~/.bashrcor equivalent if you are using a different shell for a more permanent solution.

+5
source

Source: https://habr.com/ru/post/1616832/


All Articles