如何停止使用 Anaconda 的 OpenSSL 版本

Roy*_*son 5 command-line openssl anaconda 18.04

我运行了以下命令:

sudo apt-get install --only-upgrade openssl
Run Code Online (Sandbox Code Playgroud)

输出是:

openssl is already the newest version (1.1.0g-2ubuntu4.1).
Run Code Online (Sandbox Code Playgroud)

但是,当我输入openssl version -a终端时,输出是:

OpenSSL 1.0.2o  27 Mar 2018
built on: reproducible build, date unspecified
platform: linux-x86_64
options:  bn(64,64) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx) 
compiler: /tmp/build/80754af9/openssl_1522162531585/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -I/home/vedantroy/anaconda3/include -fdebug-prefix-map=/tmp/build/80754af9/openssl_1522162531585/work=/usr/local/src/conda/openssl-1.0.2o -fdebug-prefix-map=/home/vedantroy/anaconda3=/usr/local/src/conda-prefix -Wa,--noexecstack -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
OPENSSLDIR: "/home/vedantroy/anaconda3/ssl"
Run Code Online (Sandbox Code Playgroud)

此外,输入which openssl输出:/home/vedantroy/anaconda3/bin/openssl.

看来我的系统正在使用“openssl”的 conda 安装而不是apt-get. 如何强制我的系统使用由 安装的“openssl”版本apt-get

wal*_*tor 4

该软件包安装一个名为asopenssl的可执行文件(请参阅 参考资料)。openssl/usr/bin/openssldpkg -L openssl

您已openssl安装为/home/vedantroy/anaconda3/bin/openssl.

该目录/home/vedantroy/anaconda3/bin出现在出现$PATH之前/usr/bin

$SHELL选择第一个openssl看到的。

您有多种选择:

  • 改编$PATH。然而,如果 Anaconda 想要覆盖任何其他系统二进制文件,这就会搞砸。
  • 我假设您拥有该目录/home/vedantroy/anaconda3/bin,因此chmod -x /home/vedantroy/anaconda3/bin/openssl;rehash将让您使用/usr/bin/openssl
  • 添加alias openssl="/usr/bin/openssl"到您的~/.bashrc. 仅适用于外壳。


Rav*_*ina 2

对于您的情况,我建议为apt已安装版本创建一个别名openssl

alias openssl='/usr/bin/openssl'
Run Code Online (Sandbox Code Playgroud)

将您的别名放在自动获取的地方,例如:.bashrc

您也可以直接运行它:

/usr/bin/openssl
Run Code Online (Sandbox Code Playgroud)

或者更改PATH环境变量,这对于您的情况来说不是一个好的选择,因为您实际上正在使用 Anaconda。

每当您想使用 Anaconda 版本时,请运行以下命令之一:

\openssl
""openssl
''openssl
'openssl'
"openssl"
command openssl
Run Code Online (Sandbox Code Playgroud)