Pandas unrecognized by Python3
I am using python3 in CentOS and I was able to install pandas using pip3, but when I do import pandas in python3, it throws import error: no module named pandas.
There are many reasons to not install packages through
piponly, one is that you may end up installing them globally, meaning you either wont be able or will have trouble using two different versions of the same package.
It's better to let each project have it's own dependencies, if something goes really (really) wrong you'll just nuke your project environment without hurting other projects. One of the most acceptable ways of doing this is by using virtual environments.
# creating a directory for my project $ mkdir pandas-env && cd pandas-env # creating an environment with Python 3.6.4 $ pipenv --python 3.6.4 # installing pandas in your environment $ pipenv install pandas # enter your environment $ pipenv shell # and check your python version, it's probably different # from the older system's version $ python Python 3.6.4 (default, Mar 6 2018, 10:29:06) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> # now import pandas >>> import pandas as pd >>>
To leave your environment just press CTL+D.