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
ベストアンサー1
これを行うには、それをコンパイルしてすべての依存関係をインストールする必要があります。
- 必要に応じてダウンロードしてください。 https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.x
- ファイルの解凍
tar zxvf Python-3.7.0.tar.gz --directory /tmp cd /tmp
Setup.dist
SSLを有効にするには、ファイルを編集してください。cd Python-3.7.0/Modules/ vi Setup.dist
- 次の行のコメントを外して
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
- デプロイ用のPythonの保存とコンパイル
cd ../ ./configure --enable-optimizations CFLAGS="-O3" --prefix=/opt/primeur/python3.7 make make install
試してみてください
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. >>>
pip
コマンドで更新[root@myserver bin]#./pip3 install --upgrade pip
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