python - 带有 miniforge3 的 conda 虚拟环境中的 openssl 问题
问题描述
我想在带有硅芯片的 Macbook 上的 Anaconda 环境中使用 Tensorflow,所以我按照 Github 上的说明进行操作:https ://github.com/apple/tensorflow_macos/issues/153
在 miniforge/conda 虚拟环境(tensorflowvenv)中,openssl 有一些问题。
启动 Jupyter:
Last login: Thu Apr 1 09:30:23 on ttys001
/Users/USER/miniforge3/envs/tensorflowvenv./bin/jupyter_mac.command ; exit;
(base) USER@Air-von-USER ~ % /Users/USER/miniforge3/envs/tensorflowvenv./bin/jupyter_mac.command ; exit;
Traceback (most recent call last):
File "/Users/USER/miniforge3/envs/tensorflowvenv./bin/jupyter-notebook", line 7, in
from notebook.notebookapp import main
File "/Users/USER/miniforge3/envs/tensorflowvenv./lib/python3.8/site-packages/notebook/notebookapp.py", line 60, in
from tornado import httpserver
File "/Users/USER/miniforge3/envs/tensorflowvenv./lib/python3.8/site-packages/tornado/httpserver.py", line 29, in
import ssl
File "/Users/USER/miniforge3/envs/tensorflowvenv./lib/python3.8/ssl.py", line 98, in
import _ssl # if we can't import it, let the error propagate
ImportError: dlopen(/Users/paulciupke/miniforge3/envs/tensorflowvenv./lib/python3.8/lib-dynload/_ssl.cpython-38-darwin.so, 2): Library not loaded: @rpath/libssl.1.1.dylib
Referenced from: /Users/paulciupke/miniforge3/envs/tensorflowvenv./lib/python3.8/lib-dynload/_ssl.cpython-38-darwin.so
Reason: no suitable image found. Did find:
/Users/USER/miniforge3/envs/tensorflowvenv./lib/libssl.1.1.dylib: mach-o, but wrong architecture
/Users/USER/miniforge3/envs/tensorflowvenv./lib/libssl.1.1.dylib: mach-o, but wrong architecture
/Users/USER/miniforge3/envs/tensorflowvenv./lib/python3.8/lib-dynload/../../libssl.1.1.dylib: mach-o, but wrong architecture
/Users/USER/miniforge3/envs/tensorflowvenv./lib/libssl.1.1.dylib: mach-o, but wrong architecture
/Users/USER/miniforge3/envs/tensorflowvenv./bin/../lib/libssl.1.1.dylib: mach-o, but wrong architecture
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Prozess beendet]
在 venv 中使用 pip:
(tensorflowvenv.) USER@Air-von-USER ~ % pip install random
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/random/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/random/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/random/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/random/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/random/
Could not fetch URL https://pypi.org/simple/random/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/random/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement random (from versions: none)
ERROR: No matching distribution found for random
我是虚拟环境之类的初学者,实际上我并不知道 venv 到底是做什么的。我在网上搜索了很多,对于这个或类似的问题有不同的解决方案,但对我没有任何帮助。也许这个问题有一个简单的解决方案。
更多数据:
OpenSSL> version -help
Usage: version [options]
Valid options are:
-help Display this summary
-a Show all data
-b Show build date
-d Show configuration directory
-e Show engines directory
-f Show compiler flags used
-o Show some internal datatype options
-p Show target build platform
-r Show random seeding options
-v Show library version
OpenSSL> version -a
OpenSSL 1.1.1k 25 Mar 2021
built on: Thu Mar 25 20:02:09 2021 UTC
platform: darwin64-arm64-cc
options: bn(64,64) rc4(int) des(int) idea(int) blowfish(ptr)
compiler: clang -fPIC -arch arm64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DVPAES_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -D_REENTRANT -DNDEBUG
OPENSSLDIR: "/opt/homebrew/etc/openssl@1.1"
ENGINESDIR: "/opt/homebrew/Cellar/openssl@1.1/1.1.1k/lib/engines-1.1"
Seeding source: os-specific
OpenSSL> version -b
built on: Thu Mar 25 20:02:09 2021 UTC
OpenSSL> version -d
OPENSSLDIR: "/opt/homebrew/etc/openssl@1.1"
OpenSSL> version -f
compiler: clang -fPIC -arch arm64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DVPAES_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -D_REENTRANT -DNDEBUG
OpenSSL> version -o
options: bn(64,64) rc4(int) des(int) idea(int) blowfish(ptr)
OpenSSL> version -p
platform: darwin64-arm64-cc
OpenSSL> version -r
Seeding source: os-specific
OpenSSL> version -v
OpenSSL 1.1.1k 25 Mar 2021
解决方案
推荐阅读
- android - 如何删除 android 上的 react native firebase 通知点击操作?
- c++ - 静态编译 GRPC C++ 服务
- rxjs6 - RxJS,无法让 pipe(toArray).subscribe 工作
- macos - Mono 附带的 nunit-console 已弃用,请使用 Nunit Nuget 包或其他获取 NUnit 的形式
- angular - Angular 7 无法访问管理文件夹文件
- mongodb - 我可以用MongoDB官方Golang驱动找到一条记录,但是记录是空的
- angular - 使用 angular-cli 定义一个全局 sass 变量
- java - 使用 Docker 和 Azure Kubernetes 服务使 JVM 变得轻量级
- php - Laravel 没有选择数据库
- firebase - 选择需要同步的 Firestore 集合