Imr*_*lla 9 python ssl pip kali-linux
我正在使用 Kali Linux 2020.1,我安装了 Python3.7,然后在尝试使用 pip3 命令安装模块后,我不断收到此错误消息。
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
ERROR: Could not find a version that satisfies the requirement flask (from versions: none)
ERROR: No matching distribution found for flask
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Run Code Online (Sandbox Code Playgroud)
小智 4
为此,我们必须编译它并安装每个依赖项
tar zxvf Python-3.7.0.tar.gz --directory /tmp
cd /tmp
Run Code Online (Sandbox Code Playgroud)Setup.dist以启用 SSL
cd Python-3.7.0/Modules/
vi Setup.dist
Run Code Online (Sandbox Code Playgroud)openssl主页
SSL=/usr/local/ssl <--- substitute with your openssl home directory
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
Run Code Online (Sandbox Code Playgroud)cd ../
./configure --enable-optimizations CFLAGS="-O3" --prefix=/opt/primeur/python3.7
make
make install
Run Code Online (Sandbox Code Playgroud)尝试一下
cd /opt/primeur/python3.7/bin
[root@myserver bin]# python3
Python 3.7.0 (default, May 5 2020, 22:31:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Run Code Online (Sandbox Code Playgroud)pip用命令更新
[root@myserver bin]#./pip3 install --upgrade pip
Run Code Online (Sandbox Code Playgroud)使用pip3 install类似方式安装任何依赖项
[root@myserver bin]#./pip3 install termcolor
Collecting termcolor
Using cached https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
Installing collected packages: termcolor
Running setup.py install for termcolor ... done
Successfully installed termcolor-1.1.0
Run Code Online (Sandbox Code Playgroud)