简体   繁体   English

我需要帮助安装 tensorflow、keras 和 pytorch

[英]I need help in installing tensorflow, keras, and pytorch

When I import Tensorflow , Keras or Pytorch I face these errors:当我输入TensorflowKerasPytorch我面对这些错误:
在此处输入图片说明

I'm using Window 10 and my CPU supports AVX.我使用的是 Window 10,我的 CPU 支持 AVX。 Also I was preparing my project on Python(Anaconda) and installed Keras , TensorFlow using pip ( pip install keras ) and Pytorch using conda我也正在准备我的关于Python(Anaconda)的项目,并安装KerasTensorFlow使用pippip install keras )和Pytorch使用conda

I activated my virtual environment( Test_01 ) before download, and I checked it again with conda list after download.我在下载前激活了我的虚拟环境( Test_01 ),下载后我用conda list再次检查了它。
After checking those 3 programs are installed, I imported them with ipython on Anaconda prompt.在检查安装了这 3 个程序后,我在 Anaconda 提示符下使用ipython导入了它们。 and this what I faced:这就是我所面临的:

========================================================================
(Test_01) C:\Users\User>ipython

Python 3.8.3 (default, Jul  2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import tensorflow

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-d6579f534729> in <module>
----> 1 import tensorflow

ModuleNotFoundError: No module named 'tensorflow'

In [2]: import keras

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
C:\Anaconda3\lib\site-packages\keras\__init__.py in <module>
      2 try:
----> 3     from tensorflow.keras.layers.experimental.preprocessing import RandomRotation
      4 except ImportError:

ModuleNotFoundError: No module named 'tensorflow'

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-2-88d96843a926> in <module>
----> 1 import keras

C:\Anaconda3\lib\site-packages\keras\__init__.py in <module>
      3     from tensorflow.keras.layers.experimental.preprocessing import RandomRotation
      4 except ImportError:
----> 5     raise ImportError(
      6         'Keras requires TensorFlow 2.2 or higher. '
      7         'Install TensorFlow via `pip install tensorflow`')

ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via `pip install tensorflow`

In [3]: import torch

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-3-eb42ca6e4af3> in <module>
----> 1 import torch

ModuleNotFoundError: No module named 'torch'

===========================================================================

Keras error message says: Keras错误消息说:

Keras requires TensorFlow 2.2 or higher. Keras需要TensorFlow 2.2 或更高版本。 Install TensorFlow via pip install TensorFlow通过 pip install TensorFlow安装TensorFlow

also, tensorflow and pytorch says另外,tensorflow 和 pytorch 说

ModuleNotFoundError: No module named 'tensorflow'

ModuleNotFoundError: No module named 'torch'

So I installed TensorFlow with pip again, and it says:所以我再次用pip安装了TensorFlow ,它说:

(Test_01) C:\Users\User>pip install tensorflow

Requirement already satisfied: tensorflow in c:\anaconda3\envs\test_01\lib\site-packages (2.3.1)

Requirement already satisfied: grpcio>=1.8.6 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (1.33.2)

Requirement already satisfied: wrapt>=1.11.1 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (1.12.1)

Requirement already satisfied: gast==0.3.3 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (0.3.3)

Requirement already satisfied: protobuf>=3.9.2 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (3.13.0)

Requirement already satisfied: tensorboard<3,>=2.3.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (2.3.0)

Requirement already satisfied: tensorflow-estimator<2.4.0,>=2.3.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (2.3.0)

Requirement already satisfied: google-pasta>=0.1.8 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (0.2.0)

Requirement already satisfied: absl-py>=0.7.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (0.11.0)

Requirement already satisfied: six>=1.12.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (1.15.0)

Requirement already satisfied: wheel>=0.26 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (0.35.1)

Requirement already satisfied: keras-preprocessing<1.2,>=1.1.1 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (1.1.2)
Collecting numpy<1.19.0,>=1.16.0
Using cached numpy-1.18.5-cp38-cp38-win_amd64.whl (12.8 MB)

Requirement already satisfied: termcolor>=1.1.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (1.1.0)

Requirement already satisfied: astunparse==1.6.3 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (1.6.3)

Requirement already satisfied: opt-einsum>=2.3.2 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (3.3.0)

Requirement already satisfied: h5py<2.11.0,>=2.10.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorflow) (2.10.0)

Requirement already satisfied: setuptools in c:\anaconda3\envs\test_01\lib\site-packages (from protobuf>=3.9.2->tensorflow) (50.3.0.post20201006)

Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (0.4.2)

Requirement already satisfied: markdown>=2.6.8 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (3.3.3)

Requirement already satisfied: requests<3,>=2.21.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (2.24.0)

Requirement already satisfied: google-auth<2,>=1.6.3 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (1.23.0)

Requirement already satisfied: werkzeug>=0.11.15 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (1.0.1)

Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in c:\anaconda3\envs\test_01\lib\site-packages (from tensorboard<3,>=2.3.0->tensorflow) (1.7.0)

Requirement already satisfied: requests-oauthlib>=0.7.0 in c:\anaconda3\envs\test_01\lib\site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<3,>=2.3.0->tensorflow) (1.3.0)

Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\anaconda3\envs\test_01\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (1.25.11)

Requirement already satisfied: chardet<4,>=3.0.2 in c:\anaconda3\envs\test_01\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (3.0.4)

Requirement already satisfied: certifi>=2017.4.17 in c:\anaconda3\envs\test_01\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (2020.6.20)

Requirement already satisfied: idna<3,>=2.5 in c:\anaconda3\envs\test_01\lib\site-packages (from requests<3,>=2.21.0->tensorboard<3,>=2.3.0->tensorflow) (2.10)

Requirement already satisfied: cachetools<5.0,>=2.0.0 in c:\anaconda3\envs\test_01\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<3,>=2.3.0->tensorflow) (4.1.1)

Requirement already satisfied: pyasn1-modules>=0.2.1 in c:\anaconda3\envs\test_01\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<3,>=2.3.0->tensorflow) (0.2.8)

Requirement already satisfied: rsa<5,>=3.1.4; python_version >= "3.5" in c:\anaconda3\envs\test_01\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<3,>=2.3.0->tensorflow) (4.6)

Requirement already satisfied: oauthlib>=3.0.0 in c:\anaconda3\envs\test_01\lib\site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<3,>=2.3.0->tensorflow) (3.1.0)

Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in c:\anaconda3\envs\test_01\lib\site-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard<3,>=2.3.0->tensorflow) (0.4.8)
Installing collected packages: numpy
  Attempting uninstall: numpy
    Found existing installation: numpy 1.19.2
    Uninstalling numpy-1.19.2:
      Successfully uninstalled numpy-1.19.2

ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.

We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.

torch 1.6.0 requires future, which is not installed.
Successfully installed numpy-1.18.5

===============================================================================

I promise I checked that I installed and executed them on same environment(Test_01) so Can you tell me: What Should I do ?我保证我检查过我在相同的环境(Test_01)上安装并执行了它们,所以你能告诉我:我该怎么办? and How can I check my 'CUDA' version?以及如何查看我的“CUDA”版本? I tried it with 'nvxx --version' on cmd and nothing works我在 cmd 上用 'nvxx --version' 尝试过,但没有任何效果

First, i should thank you all of you made comment in my post.首先,我要感谢大家在我的帖子中发表评论。 I found that visual studio c++ was not installed, so i installed it to my labtop.我发现没有安装visual studio c++,所以我把它安装到了我的labtop上。 You can found it here https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads你可以在这里找到它https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM