Search code examples
pythonanacondaaiohttp

python anaconda - manage module for different python versions


I have 2 version of Python in my mac(2.7 and 3.5.1) in my Anaconda. When every I

pip install xxx

it will automatically go into /anaconda/lib/python2.7/site-packages folder. Now I want to learn aiohttp and when I install it

pip install aiohttp

it will give me error:

raise RuntimeError("aiohttp requires Python 3.4.1+") RuntimeError: aiohttp requires Python 3.4.1+

---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in

/private/var/folders/c2/3yxfnvc51fng531jz312t00m0000gn/T/pip-build-m_mCpM/aiohttp/

  1. How can I resolve this?
  2. What is the best way to manage the 2 versions of Python in Anaconda?

Solution

  • In general you can create new environments, with whatever python and packages you need, for whatever project you are working on. In this specific instance, if you want to use the aiohttp that requires the higher python, I would do the following:

    conda create -n py35 python=3.5
    source activate py35
    pip install aiohttp
    

    This will install aiohttp in your py35 environment.