我试图用Anaconda3.9.9安装TensorFlow。
我执行了命令
pip install tensorflow有个错误说:
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
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/tensorflow/
Could not fetch URL https://pypi.org/simple/tensorflow/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/tensorflow/ (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 tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow我尝试将/anaconda3、/anaconda3/Scripts和/anaconda3/library/bin添加到Path变量中。我还尝试运行以下命令:
pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org tensorflow但似乎什么都没起作用。
我错过了什么吗?还有别的解决办法吗?
发布于 2022-02-10 11:12:00
尝试在命令下面运行以修复此问题:
pip install --upgrade
pip install ssl请创建一个virtual_environment以在Anaconda中安装TensorFlow。
按照下面的代码在virtual_environment中安装virtual_environment:
conda create -n tf tensorflow #Create a Virtual environment(tf).
conda activate tf #Activate the Virtual environment
pip install tensorflow #install TensorFlow in it.注意:每次使用TensorFlow时都需要激活virtual_environment。
https://stackoverflow.com/questions/70528867
复制相似问题