上篇明白到目前Tensorflow的狀況如何,是時候重新建立環境了,我使用Anaconda建立環境,在下載Keras的時候,出現問題:
UnsatisfiableError: The following specifications were found to be incompatible with the existing python installation in your environment:
Specifications:
- keras -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0']
Your python: python=3.8
If python is on the left-most side of the chain, that's the version you've asked for. When python appears to the right, that indicates that the thing on the left is somehow not available for the python version you are constrained to. Note that conda will not change your python version to a different minor version unless you explicitly specify that.
上面bug大意就是,Keras必須要用Python3.7版本才可以,無法使用最新的3.8版本。可是這警告讓我感到很奇怪,Python怎麼可能會不管機器學習這麼重要的環境,就提升版本。
我查了如果不是透過Anaconda建立環境,而是直接用Python,3.8版本可以建立Keras的環境,但我還是想要在Anaconda上使用Python,因此就用了以下兩個指令:
pip install --target=anaconda3/envs/Keras38/lib/python3.8/site-packages tensorflow
pip install --target=anaconda3/envs/Keras38/lib/python3.8/site-packages keras