仍然在我的教程中学习python,我被告知要做
sudo -H pip install requests
Run Code Online (Sandbox Code Playgroud)
我得到以下内容:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting requests
Could not fetch URL https://pypi.python.org/simple/requests/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
Run Code Online (Sandbox Code Playgroud)
有人会知道我该怎么做才能彻底解决该问题吗?
提前非常感谢
我使用Linux发行版,并且由于新安装了Python 3.6而面临这个问题。我尝试了几种解决方案,最后解决了问题。我遵循的步骤如下。
像发行版一样在Debian上
sudo apt-get install build-essential checkinstall libreadline-gplv2-dev ibncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
Run Code Online (Sandbox Code Playgroud)
将目录更改为Python3.6位置
cd /path/to/Python3.6/Module/
Run Code Online (Sandbox Code Playgroud)
在模块目录中,Setup使用首选文本编辑器打开文件
vi Setup
Run Code Online (Sandbox Code Playgroud)
搜索SSL并取消注释相关行。
ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
Run Code Online (Sandbox Code Playgroud)
保存文件,并在Python包的根文件夹中,运行以下命令。
make
sudo make install
Run Code Online (Sandbox Code Playgroud)
最后,运行pip3来安装所需的模块。