How to update OpenSSL on mac?

前端 未结 2 730
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-20 12:50

I need to ensure that I have OpenSSL version of 1.0.1 or greater to connect to the Salesforce API according to this documentation.

According to this question, I can

相关标签:
2条回答
  • 2020-12-20 13:05

    I think this is a multi-part issue with the versions of Python you are using and your $PATH variable.

    First check where you're looking for Python by using this command in the terminal:

    which python
    

    It should output something like this: /usr/local/bin/python

    Then check for the path that you have setup.

    echo $PATH
    

    Likely you're seeing something like:

    /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/username/anaconda/bin:/usr/bin:/bin:/usr/sbin:/sbin
    

    The issue is probably that the version of python tied to your default when you enter python in your terminal is not one that has the modern version of openssl.

    In other words:

    openssl version -a
    

    Is checking for openssl somewhere different than

    python -c "import ssl; print ssl.OPENSSL_VERSION"
    

    To fix this, you might try editing your $PATH variable.

    I suggest doing this by editing something like your ~/.bash_profile file. You can add something like this to specify a different Python binary to use:

    export PATH="/usr/local/bin:$PATH"
    

    Plop this on the end of your .bash_profile file and then whenever you're using bash it should look for Python in the /usr/local/bin directory before looking elsewhere. Keep in mind that this might also affect places that other programs look for Python (or other binaries).

    0 讨论(0)
  • 2020-12-20 13:18

    @fernando's answer had the right theory but his recommendation for a next step didn't work for me, because /usr/local/bin was already first in my $PATH. Here's how I fixed mine:

    In the response for brew info python I saw:

    ==> Caveats This formula installs a python2 executable to /usr/local/bin. If you wish to have this formula's python executable in your PATH then add the following to ~/.bash_profile: export PATH="/usr/local/opt/python/libexec/bin:$PATH"

    I added that last line to my ~/.bash_profile, opened a new terminal window, and it worked.

    0 讨论(0)
提交回复
热议问题