[Python] Installing hyperledger indy node code fails on python3 not being default on Mac

Discussão em 'Python' iniciado por Stack, Março 17, 2025.

  1. Stack

    Stack Membro Participativo

    I am installing Hyperledger Indy (sovrin) self-identity software per these instructions.

    I have Python2.7 installed via Anaconda 3. I also have Python3.6.3 installed that I downloaded and installed from here.

    I'm trying to install some other software that has a dependency for Python > 3.5.

    I've tried several methods to change my default Python:


    1. Per this SO I set it manual in current terminal window:

      alias python='python3'


    2. Per same SO I vi .bash_profile and added:

      alias python='python3'

    then source ~/.bash_profile

    1. Set a link to Python3:

    bc-computer:~ momi$ unlink /usr/local/bin/python2 bc-computer:~ momi$ ln -s /usr/local/bin/python3 /usr/local/bin/python

    but still continue to get the same error:

    bc-computer:~ momi$ pip install indy-node-dev
    Collecting indy-node-dev
    Using cached indy-node-dev-1.2.227.tar.gz
    Complete output from command python setup.py egg_info:
    FAIL: Requires Python 3.5 or later, but setup.py was run using 2.7.14
    NOTE: Installation failed. Run setup.py using python3

    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/3f/sh6dr8wx6w720b1_w38f_fh00000gq/T/pip-build-ecZnYY/indy-node-dev/


    I also tried setting up a python3 test environment per this:

    python3 setup.py test


    And got this error:

    > /usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python:
    > can't open file 'setup.py': [Errno 2] No such file or directory


    Please note that I tried this suggestion which seems to be the non-duplicate answer but didn't work for me:


    The safest way is to set an alias in ~/.bashrc:

    alias python=python3
    ​

    My environment:

    uname -msra
    Darwin bc-computer.local 17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64 x86_64


    My OS: High Sierra 10.13.1

    which -a python
    /Users/momi/anaconda2/bin/python
    /usr/local/bin/python
    /usr/bin/python


    Thank you

    Continue reading...

Compartilhe esta Página