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

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

问题描述

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

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

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

  1. 旧版更新
  2. 简单安装openssl
  3. brew链接--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

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

然后检查已设置的路径.

Then check for the path that you have setup.

echo $PATH

就像您看到的那样:

/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天全站免登陆