ModuleNotFoundError:anaconda中没有名为“ tensorflow”的模块

穆罕默德·马吉(Mohamed Magdy)

当我尝试导入tensorflow时,conda提示中出现此错误

NumPy和所有包都已导入且没有错误

我在C语言中有keras,但它也不起作用。我越来越尝试通过许多不同的方式来安装tensorflow

我该如何解决?

(base) C:\Users\ASUS>conda install -c conda-forge tensorflow
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\ASUS\Anaconda3\Anaconda

  added / updated specs:
    - tensorflow


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    absl-py-0.9.0              |   py36h9f0ad1d_1         162 KB  conda-forge
    astor-0.7.1                |             py_0          22 KB  conda-forge
    gast-0.3.3                 |             py_0          12 KB  conda-forge
    grpcio-1.23.0              |   py36hc6b9980_1         1.0 MB  conda-forge
    importlib-metadata-1.6.0   |   py36h9f0ad1d_0          42 KB  conda-forge
    keras-applications-1.0.8   |             py_1          30 KB  conda-forge
    keras-preprocessing-1.1.0  |             py_0          33 KB  conda-forge
    libprotobuf-3.11.4         |       h1a1b453_0         2.2 MB  conda-forge
    markdown-3.2.2             |             py_0          61 KB  conda-forge
    protobuf-3.11.4            |   py36h97ec31f_1         584 KB  conda-forge
    python_abi-3.6             |          1_cp36m           4 KB  conda-forge
    tensorboard-1.13.1         |           py36_0         3.3 MB  conda-forge
    tensorflow-1.13.2          |       h21ff451_0          22 KB  conda-forge
    tensorflow-base-1.13.2     |           py36_0        52.5 MB  conda-forge
    tensorflow-estimator-1.13.0|   py36h39e3cac_0         475 KB  conda-forge
    termcolor-1.1.0            |             py_2           6 KB  conda-forge
    ------------------------------------------------------------
                                           Total:        60.5 MB

The following NEW packages will be INSTALLED:

  absl-py            conda-forge/win-64::absl-py-0.9.0-py36h9f0ad1d_1
  astor              conda-forge/noarch::astor-0.7.1-py_0
  gast               conda-forge/noarch::gast-0.3.3-py_0
  grpcio             conda-forge/win-64::grpcio-1.23.0-py36hc6b9980_1
  importlib-metadata conda-forge/win-64::importlib-metadata-1.6.0-py36h9f0ad1d_0
  keras-applications conda-forge/noarch::keras-applications-1.0.8-py_1
  keras-preprocessi~ conda-forge/noarch::keras-preprocessing-1.1.0-py_0
  libprotobuf        conda-forge/win-64::libprotobuf-3.11.4-h1a1b453_0
  markdown           conda-forge/noarch::markdown-3.2.2-py_0
  protobuf           conda-forge/win-64::protobuf-3.11.4-py36h97ec31f_1
  python_abi         conda-forge/win-64::python_abi-3.6-1_cp36m
  tensorboard        conda-forge/win-64::tensorboard-1.13.1-py36_0
  tensorflow         conda-forge/win-64::tensorflow-1.13.2-h21ff451_0
  tensorflow-base    conda-forge/win-64::tensorflow-base-1.13.2-py36_0
  tensorflow-estima~ conda-forge/win-64::tensorflow-estimator-1.13.0-py36h39e3cac_0
  termcolor          conda-forge/noarch::termcolor-1.1.0-py_2

The following packages will be UPDATED:

  ca-certificates     pkgs/main::ca-certificates-2020.1.1-0 --> conda-forge::ca-certificates-2020.4.5.1-hecc5488_0
  conda                       pkgs/main::conda-4.8.3-py36_0 --> conda-forge::conda-4.8.3-py36h9f0ad1d_1

The following packages will be SUPERSEDED by a higher-priority channel:

  certifi              pkgs/main::certifi-2020.4.5.1-py36_0 --> conda-forge::certifi-2020.4.5.1-py36h9f0ad1d_0
  openssl                                         pkgs/main --> conda-forge


Proceed ([y]/n)? y


Downloading and Extracting Packages
astor-0.7.1          | 22 KB     | ############################################################################ | 100%
markdown-3.2.2       | 61 KB     | ############################################################################ | 100%
grpcio-1.23.0        | 1.0 MB    | ############################################################################ | 100%
gast-0.3.3           | 12 KB     | ############################################################################ | 100%
termcolor-1.1.0      | 6 KB      | ############################################################################ | 100%
tensorflow-1.13.2    | 22 KB     | ############################################################################ | 100%
keras-applications-1 | 30 KB     | ############################################################################ | 100%
libprotobuf-3.11.4   | 2.2 MB    | ############################################################################ | 100%
importlib-metadata-1 | 42 KB     | ############################################################################ | 100%
keras-preprocessing- | 33 KB     | ############################################################################ | 100%
tensorboard-1.13.1   | 3.3 MB    | ############################################################################ | 100%
tensorflow-base-1.13 | 52.5 MB   | ############################################################################ | 100%
absl-py-0.9.0        | 162 KB    | ############################################################################ | 100%
python_abi-3.6       | 4 KB      | ############################################################################ | 100%
protobuf-3.11.4      | 584 KB    | ############################################################################ | 100%
tensorflow-estimator | 475 KB    | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(base) C:\Users\ASUS>python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import cv2
>>> import tensorflow
C:\Users\ASUS\Anaconda3\Anaconda\lib\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\ASUS\Anaconda3\Anaconda\lib\site-packages\tensorflow\python\framework\dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\ASUS\Anaconda3\Anaconda\lib\site-packages\tensorflow\python\framework\dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\ASUS\Anaconda3\Anaconda\lib\site-packages\tensorflow\python\framework\dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\ASUS\Anaconda3\Anaconda\lib\site-packages\tensorflow\python\framework\dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\ASUS\Anaconda3\Anaconda\lib\site-packages\tensorflow\python\framework\dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
C:\Users\ASUS\Anaconda3\Anaconda\lib\site-packages\h5py\__init__.py:40: UserWarning: h5py is running against HDF5 1.10.5 when it was built against 1.10.4, this may cause problems
  '{0}.{1}.{2}'.format(*version.hdf5_built_version_tuple)
Warning! ***HDF5 library version mismatched error***
The HDF5 header files used to compile this application do not match
the version used by the HDF5 library to which this application is linked.
Data corruption or segmentation faults may occur if the application continues.
This can happen when an application was compiled by one version of HDF5 but
linked with a different version of static or shared HDF5 library.
You should recompile the application or check your shared library related
settings such as 'LD_LIBRARY_PATH'.
You can, at your own risk, disable this warning by setting the environment
variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.
Setting it to 2 or higher will suppress the warning messages totally.
Headers are 1.10.4, library is 1.10.5
        SUMMARY OF THE HDF5 CONFIGURATION
        =================================

General Information:
-------------------
                   HDF5 Version: 1.10.5
                  Configured on: 2019-03-04
                  Configured by: Visual Studio 14 2015 Win64
                    Host system: Windows-10.0.17763
              Uname information: Windows
                       Byte sex: little-endian
             Installation point: C:/Program Files/HDF5

Compiling Options:
------------------
                     Build Mode:
              Debugging Symbols:
                        Asserts:
                      Profiling:
             Optimization Level:

Linking Options:
----------------
                      Libraries:
  Statically Linked Executables: OFF
                        LDFLAGS: /machine:x64
                     H5_LDFLAGS:
                     AM_LDFLAGS:
                Extra libraries:
                       Archiver:
                         Ranlib:

Languages:
----------
                              C: yes
                     C Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe 19.0.24218.1
                       CPPFLAGS:
                    H5_CPPFLAGS:
                    AM_CPPFLAGS:
                         CFLAGS:  /DWIN32 /D_WINDOWS /W3
                      H5_CFLAGS:
                      AM_CFLAGS:
               Shared C Library: YES
               Static C Library: YES

                        Fortran: OFF
               Fortran Compiler:
                  Fortran Flags:
               H5 Fortran Flags:
               AM Fortran Flags:
         Shared Fortran Library: YES
         Static Fortran Library: YES

                            C++: ON
                   C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe 19.0.24218.1
                      C++ Flags: /DWIN32 /D_WINDOWS /W3 /GR /EHsc
                   H5 C++ Flags:
                   AM C++ Flags:
             Shared C++ Library: YES
             Static C++ Library: YES

                            JAVA: OFF
                   JAVA Compiler:

Features:
---------
                   Parallel HDF5: OFF
Parallel Filtered Dataset Writes:
              Large Parallel I/O:
              High-level library: ON
                    Threadsafety: OFF
             Default API mapping: v110
  With deprecated public symbols: ON
          I/O filters (external):  DEFLATE DECODE ENCODE
                             MPE:
                      Direct VFD:
                         dmalloc:
  Packages w/ extra debug output:
                     API Tracing: OFF
            Using memory checker: OFF
 Memory allocation sanity checks: OFF
          Function Stack Tracing: OFF
       Strict File Format Checks: OFF
    Optimization Instrumentation:
Bye...

(base) C:\Users\ASUS>python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
C:\Users\ASUS\Anaconda3\Anaconda\lib\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\ASUS\Anaconda3\Anaconda\lib\site-packages\tensorflow\python\framework\dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\ASUS\Anaconda3\Anaconda\lib\site-packages\tensorflow\python\framework\dtypes.py:528: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\ASUS\Anaconda3\Anaconda\lib\site-packages\tensorflow\python\framework\dtypes.py:529: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\ASUS\Anaconda3\Anaconda\lib\site-packages\tensorflow\python\framework\dtypes.py:530: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\ASUS\Anaconda3\Anaconda\lib\site-packages\tensorflow\python\framework\dtypes.py:535: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
C:\Users\ASUS\Anaconda3\Anaconda\lib\site-packages\h5py\__init__.py:40: UserWarning: h5py is running against HDF5 1.10.5 when it was built against 1.10.4, this may cause problems
  '{0}.{1}.{2}'.format(*version.hdf5_built_version_tuple)
Warning! ***HDF5 library version mismatched error***
The HDF5 header files used to compile this application do not match
the version used by the HDF5 library to which this application is linked.
Data corruption or segmentation faults may occur if the application continues.
This can happen when an application was compiled by one version of HDF5 but
linked with a different version of static or shared HDF5 library.
You should recompile the application or check your shared library related
settings such as 'LD_LIBRARY_PATH'.
You can, at your own risk, disable this warning by setting the environment
variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.
Setting it to 2 or higher will suppress the warning messages totally.
Headers are 1.10.4, library is 1.10.5
        SUMMARY OF THE HDF5 CONFIGURATION
        =================================

General Information:
-------------------
                   HDF5 Version: 1.10.5
                  Configured on: 2019-03-04
                  Configured by: Visual Studio 14 2015 Win64
                    Host system: Windows-10.0.17763
              Uname information: Windows
                       Byte sex: little-endian
             Installation point: C:/Program Files/HDF5

Compiling Options:
------------------
                     Build Mode:
              Debugging Symbols:
                        Asserts:
                      Profiling:
             Optimization Level:

Linking Options:
----------------
                      Libraries:
  Statically Linked Executables: OFF
                        LDFLAGS: /machine:x64
                     H5_LDFLAGS:
                     AM_LDFLAGS:
                Extra libraries:
                       Archiver:
                         Ranlib:

Languages:
----------
                              C: yes
                     C Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe 19.0.24218.1
                       CPPFLAGS:
                    H5_CPPFLAGS:
                    AM_CPPFLAGS:
                         CFLAGS:  /DWIN32 /D_WINDOWS /W3
                      H5_CFLAGS:
                      AM_CFLAGS:
               Shared C Library: YES
               Static C Library: YES

                        Fortran: OFF
               Fortran Compiler:
                  Fortran Flags:
               H5 Fortran Flags:
               AM Fortran Flags:
         Shared Fortran Library: YES
         Static Fortran Library: YES

                            C++: ON
                   C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe 19.0.24218.1
                      C++ Flags: /DWIN32 /D_WINDOWS /W3 /GR /EHsc
                   H5 C++ Flags:
                   AM C++ Flags:
             Shared C++ Library: YES
             Static C++ Library: YES

                            JAVA: OFF
                   JAVA Compiler:

Features:
---------
                   Parallel HDF5: OFF
Parallel Filtered Dataset Writes:
              Large Parallel I/O:
              High-level library: ON
                    Threadsafety: OFF
             Default API mapping: v110
  With deprecated public symbols: ON
          I/O filters (external):  DEFLATE DECODE ENCODE
                             MPE:
                      Direct VFD:
                         dmalloc:
  Packages w/ extra debug output:
                     API Tracing: OFF
            Using memory checker: OFF
 Memory allocation sanity checks: OFF
          Function Stack Tracing: OFF
       Strict File Format Checks: OFF
    Optimization Instrumentation:
Bye...
(base) C:\Users\ASUS>pip install tensorflow
Requirement already satisfied: tensorflow in c:\users\asus\anaconda3\anaconda\lib\site-packages (1.13.2)
Requirement already satisfied: astor>=0.6.0 in c:\users\asus\anaconda3\anaconda\lib\site-packages (from tensorflow) (0.8.1)
Requirement already satisfied: wheel>=0.26 in c:\users\asus\anaconda3\anaconda\lib\site-packages (from tensorflow) (0.34.2)
Requirement already satisfied: protobuf>=3.6.1 in c:\users\asus\anaconda3\anaconda\lib\site-packages (from tensorflow) (3.12.0)
Requirement already satisfied: gast>=0.2.0 in c:\users\asus\anaconda3\anaconda\lib\site-packages (from tensorflow) (0.3.3)
Requirement already satisfied: numpy<2.0,>=1.16.0 in c:\users\asus\anaconda3\anaconda\lib\site-packages (from tensorflow) (1.18.4)
WARNING: No metadata found in c:\users\asus\anaconda3\anaconda\lib\site-packages
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'c:\\users\\asus\\anaconda3\\anaconda\\lib\\site-packages\\numpy-1.18.4.dist-info\\METADATA'
(base) C:\Users\ASUS>pip install tensorflow-gpu
Collecting tensorflow-gpu
  Downloading tensorflow_gpu-2.2.0-cp36-cp36m-win_amd64.whl (460.3 MB)
     |████████████████████████████████| 460.3 MB 811 bytes/s
Requirement already satisfied: protobuf>=3.8.0 in c:\users\asus\anaconda3\anaconda\lib\site-packages (from tensorflow-gpu) (3.12.0)
Requirement already satisfied: absl-py>=0.7.0 in c:\users\asus\anaconda3\anaconda\lib\site-packages (from tensorflow-gpu) (0.9.0)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/tensorflow-gpu-estimator/
Collecting tensorflow-gpu-estimator<2.3.0,>=2.2.0
  Downloading tensorflow_gpu_estimator-2.2.0-py2.py3-none-any.whl (470 kB)
     |████████████████████████████████| 470 kB 364 kB/s
Requirement already satisfied: wheel>=0.26; python_version >= "3" in c:\users\asus\anaconda3\anaconda\lib\site-packages (from tensorflow-gpu) (0.34.2)
Requirement already satisfied: numpy<2.0,>=1.16.0 in c:\users\asus\anaconda3\anaconda\lib\site-packages (from tensorflow-gpu) (1.18.4)
WARNING: No metadata found in c:\users\asus\anaconda3\anaconda\lib\site-packages
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'c:\\users\\asus\\anaconda3\\anaconda\\lib\\site-packages\\numpy-1.18.4.dist-info\\METADATA'

我想在没有envs的情况下安装tensorflow我想在我的python中安装它

Tensorflow战士

尽管该解决方案在Github中进行了介绍,但为了Stackoverflow社区的利益,我在这里发布了解决方案。

错误:由于环境错误而无法安装软件包:[Errno 2]没有这样的文件或目录:'c:\ users \ asus \ anaconda3 \ anaconda \ lib \ site-packages \ numpy-1.18.4.dist-info \元数据

它说处没有METADATA文件c:\\users\\asus\\anaconda3\\anaconda\\lib\\site-packages\\numpy-1.18.4.dist-info\\

可以使用以下方法解决。

第一种方法:创建一个空METADATA文件并将其放置在pip所查找的位置

第二种方法:将文件夹numpy-1.18.4.dist-info移出,然后再次运行主安装。

第三种方法:在提示Anaconda中pip install tensorflow --user

有关更多详细信息,请参阅此处

如果没有一种方法不能解决您的问题,请告知我们。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

ModuleNotFoundError:没有名为“tensorflow.python”的模块Anaconda

ModuleNotFoundError:anaconda spyder中没有名为“ pyLDAvis”的模块

ModuleNotFoundError:没有名为“ tensorflow”的模块

ModuleNotFoundError:Jupyter Notebook中没有名为“ tensorflow”的模块

tensorflow在anaconda控制台中工作,在笔记本中失败:.ModuleNotFoundError:没有名为“ tensorflow”的模块

Anaconda Python:ModuleNotFoundError:没有名为“ matlab”的模块

Anaconda:ModuleNotFoundError:没有名为“conda”的模块

ModuleNotFoundError:没有名为“ tensorflow.contrib.framework”的模块

ModuleNotFoundError:没有名为“ tensorflow.examples”的模块

ModuleNotFoundError:没有名为“ tensorflow.tensorboard.tensorboard”的模块

ModuleNotFoundError:没有名为“ tensorflow.examples.tutorials”的模块

ModuleNotFoundError:没有名为“ tensorflow”的模块与代码

jupyter ModuleNotFoundError:没有名为 Tensorflow 或 keras 的模块

ModuleNotFoundError:Python中没有名为“ sksurv”的模块

ModuleNotFoundError:virtualenv中没有名为“ _tkinter”的模块

ModuleNotFoundError:Qt Creator中没有名为“ pandas”的模块

ModuleNotFoundError:Python 中没有名为“plyer”的模块

ModuleNotFoundError:在python 3.9中没有名为“ scipy”的模块

ModuleNotFoundError:jupyter中没有名为“ pymysql”的模块

在Jupyter Notebook ModuleNotFoundError中:没有名为'plotly'的模块

ModuleNotFoundError:python中没有名为“src”的模块

ModuleNotFoundError:在Python IDE中没有名为“ seaborn”的模块

ModuleNotFoundError:Django 中没有名为“posts”的模块

“ModuleNotFoundError:.spec 文件中没有名为‘kivymd’的模块”

ModuleNotFoundError:python中没有名为“display”的模块

ModuleNotFoundError:Thonny中没有名为“ PIL”的模块

ModuleNotFoundError:Google colab中没有名为“ cudf”的模块

ModuleNotFoundError:没有名为“ knox”的模块

ModuleNotFoundError:没有名为“项目”的模块