Search code examples
pythonpipinstallationanacondamesa-abm

How to install mesa (python package) for use in python 3


I have installed mesa via:

$ pip install mesa

but it is automatically installing it into

/Users/MyName/Documents/User/lib/python2.7/site-packages/mesa/~

which means that when I try to run it with a Python 3 kernel, it can't find the module and I receive the error

ModuleNotFoundError: No module named 'mesa'

Could someone help me out? I'm assuming the problem is that it is automatically installed into the python 2.7 directory - how can i change this?

Thanks


Solution

  • To install packages for Python3 while exists Python2,

    try this

    python3 -m pip install xxx
    

    or this

    sudo apt install pip3 
    pip3 install xxx