我使用的是Python 3.6。当我尝试使用pip3安装“模块”时,我遇到了这个问题:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available

当前回答

你可以尝试brew链接,它会告诉你正确的说明:

$ brew link openssl --force
Warning: Refusing to link macOS provided/shadowed software: openssl@1.1
If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

其他回答

我用的是macOS,我用过brew,但Vaulstein在他的回答中提到的并没有涵盖我的情况。

我运行以下命令,以确保我当前的python没有通过brew安装

brew list | grep python           
python
python@2

brew info python
python@3.8: stable 3.8.3 (bottled)
Interpreted, interactive, object-oriented programming language
https://www.python.org/
Not installed
... 

所以我从https://www.python.org/下载了最新的3.8.5,安装时我看到了以下信息

证书验证和OpenSSL 此包包含自己的私有OpenSSL 1.1.1副本。的 管理的系统和用户密钥链中的信任证书 Python ssl模块不默认使用Keychain Access应用程序和安全命令行实用程序

在安装3.8.5之后,它修复了这个问题。

在我的例子中,我重新安装了Python。这就解决了问题。

brew reinstall python

在尝试自己编译python后,仍然缺乏ssl模块,我最终尝试从apt安装缺少的模块,就像这样:

安装python3-openssl

对于未来试图解决这个问题的Oracle Linux用户,下面是对我有用的方法。 首先安装缺少的库:

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel 
readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

然后cd到Python3。X库并运行:

make
make install 

在Windows 10 SQL Server 19中,解决方案是已知的。

复制以下文件:

libssl-1_1-x64.dll libcrypto-1_1-x64.dll

从文件夹中

C:\Program Files\Microsoft SQL Server\MSSSQL15。MSSQLSERVER \ PYTHON_SERVICES \图书馆\ bin

到文件夹

C:\Program Files\Microsoft SQL Server\MSSSQL15。MSSQLSERVER \ PYTHON_SERVICES \ dll

然后打开一个新的DOS命令shell提示符。

从https://learn.microsoft.com/en-us/sql/machine-learning/troubleshooting/known-issues-for-sql-server-machine-learning-services?view=sql-server-ver15 # 7 -不-安装- python包-使用- pip -后-安装- sql - server - windows - 2019