如何在 mac 上更新 OpenSSL? [英] How to update OpenSSL on mac?

查看:73
本文介绍了如何在 mac 上更新 OpenSSL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 ,我需要确保我的 OpenSSL 版本为 1.0.1 或更高版本才能连接到 Salesforce API本文档.

根据这个问题,我可以做到以下步骤(我已成功完成)

According to this question, I can do the following steps (which I've completed successfully)

  1. 酿造更新
  2. brew install openssl
  3. brew link --force openssl

当我运行 openssl version -a 时,我得到以下信息:

When I run openssl version -a, I get the following:

OpenSSL 1.0.2h  3 May 2016
built on: reproducible build, date unspecified
platform: darwin64-x86_64-cc
options:  bn(64,64) rc4(ptr,int) des(idx,cisc,16,int) idea(int) blowfish(idx) 
compiler: /usr/bin/clang -I. -I.. -I../include  -fPIC -fno-common -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch x86_64 -O3 -DL_ENDIAN -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
OPENSSLDIR: "/opt/local/etc/openssl"

但是,当我运行 python -c "import ssl; print ssl.OPENSSL_VERSION" 时,我得到以下信息:

However, when I run python -c "import ssl; print ssl.OPENSSL_VERSION", I get the following:

OpenSSL 0.9.8zh 14 Jan 2016

我从我的计算机收到混合信号,但我的 salesforce 模块仍然无法工作,所以我知道 OpenSSL 没有在我的计算机上完全更新.

I'm getting mixed signals from my computer, but my salesforce module is still not working, so I know OpenSSL is not updated completely on my computer.

我还应该提到我也尝试过:

I should also mention that I've also tried:

sudo port upgrade openssl

端口似乎有效,但是当我运行 python -c "import ssl; print ssl.OPENSSL_VERSION" 时,我仍然知道我在OpenSSL 0.9.8zh"上

Port seemed to have worked, but when I run python -c "import ssl; print ssl.OPENSSL_VERSION" I still get that I'm on "OpenSSL 0.9.8zh"

还有其他更新 OpenSSL 的方法吗?

Is there another way to update OpenSSL?

推荐答案

我认为这是您使用的 Python 版本和您的 $PATH 变量的多部分问题.

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

首先在终端中使用此命令检查您正在寻找 Python 的位置:

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

which python

它应该输出如下内容:/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

问题可能是当您在终端中输入 python 时与您的默认值绑定的 python 版本不是具有现代版本的 openssl 的版本.

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.

换句话说:

openssl version -a

正在检查与

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

要解决此问题,您可以尝试编辑 $PATH 变量.

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

我建议通过编辑诸如 ~/.bash_profile 文件之类的内容来执行此操作.您可以添加类似这样的内容来指定要使用的不同 Python 二进制文件:

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"

把它放在你的 .bash_profile 文件的末尾,然后每当你使用 bash 它应该在 /usr/local/bin 目录中查找 Python 之前在别处寻找.请记住,这也可能会影响其他程序查找 Python(或其他二进制文件)的位置.

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).

这篇关于如何在 mac 上更新 OpenSSL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆