python 深度学习 解决遇到的报错问题

2023-11-03

目录

一、解决报错ModuleNotFoundError: No module named ‘tensorflow.examples

二、解决报错ModuleNotFoundError: No module named ‘tensorflow.contrib‘

三、安装onnx报错assert CMAKE, ‘Could not find “cmake“ executable!‘

四、ImportError: cannot import name 'builder' from 'google.protobuf.internal'

五、解决ModuleNotFoundError: No module named 'sklearn'

六、解决AttributeError: module ‘torch._C‘ has no attribute ‘_cuda_setDevice‘

七、解决ImportError: Missing optional dependency 'pytables'.  Use pip or conda to install pytables.

八、解决AttributeError: module ‘distutils’ has no attribute ‘version’.


一、解决报错ModuleNotFoundError: No module named ‘tensorflow.examples

注意:MNIST数据集下载完成后不要解压,直接放入mnist_data文件夹下读取即可。

问题:我在用tensorflow做mnist数据集案例,报错了。

原因:tensorflow中没有examples。
解决方法:(1)首先找到对应tensorflow的文件,我的是在D:\python3\Lib\site-packages\tensorflow(python的安装目录),进入tensorflow文件夹,发现没有examples文件夹。 

我们可以进入github下载:mirrors / tensorflow / tensorflow · GitCode

(2)下载完成后将\tensorflow-master\tensorflow\目录下的examples文件夹复制到本地tensorflow文件夹中,然后在重新运行代码即可。

(3)之后发现还是没能解决问题,发现examples中缺少tutorials文件夹。在官方的github中没发现这个文件,在其他博主那里下载到了该文件。

下载地址: 百度网盘 请输入提取码

提取码:cxy7

(4)但是依旧没有解决问题…
前面博主使用的应该是tf1.0的版本。参考其他博主的方法解决了问题。

  • 在工程下新建一个input_data.py文件,将tutorials文件夹下mnist中的input_data.py的内容复制到该文件中,
  • 再在主文件中import input_data一下。

input_data.py文件内容放在下面,需要的自取。

# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Functions for downloading and reading MNIST data (deprecated).

This module and all its submodules are deprecated.
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import collections
import gzip
import os

import numpy
from six.moves import urllib
from six.moves import xrange  # pylint: disable=redefined-builtin

from tensorflow.python.framework import dtypes
from tensorflow.python.framework import random_seed
from tensorflow.python.platform import gfile
from tensorflow.python.util.deprecation import deprecated

_Datasets = collections.namedtuple('_Datasets', ['train', 'validation', 'test'])

# CVDF mirror of http://yann.lecun.com/exdb/mnist/
DEFAULT_SOURCE_URL = 'https://storage.googleapis.com/cvdf-datasets/mnist/'


def _read32(bytestream):
  dt = numpy.dtype(numpy.uint32).newbyteorder('>')
  return numpy.frombuffer(bytestream.read(4), dtype=dt)[0]


@deprecated(None, 'Please use tf.data to implement this functionality.')
def _extract_images(f):
  """Extract the images into a 4D uint8 numpy array [index, y, x, depth].

  Args:
    f: A file object that can be passed into a gzip reader.

  Returns:
    data: A 4D uint8 numpy array [index, y, x, depth].

  Raises:
    ValueError: If the bytestream does not start with 2051.

  """
  print('Extracting', f.name)
  with gzip.GzipFile(fileobj=f) as bytestream:
    magic = _read32(bytestream)
    if magic != 2051:
      raise ValueError('Invalid magic number %d in MNIST image file: %s' %
                       (magic, f.name))
    num_images = _read32(bytestream)
    rows = _read32(bytestream)
    cols = _read32(bytestream)
    buf = bytestream.read(rows * cols * num_images)
    data = numpy.frombuffer(buf, dtype=numpy.uint8)
    data = data.reshape(num_images, rows, cols, 1)
    return data


@deprecated(None, 'Please use tf.one_hot on tensors.')
def _dense_to_one_hot(labels_dense, num_classes):
  """Convert class labels from scalars to one-hot vectors."""
  num_labels = labels_dense.shape[0]
  index_offset = numpy.arange(num_labels) * num_classes
  labels_one_hot = numpy.zeros((num_labels, num_classes))
  labels_one_hot.flat[index_offset + labels_dense.ravel()] = 1
  return labels_one_hot


@deprecated(None, 'Please use tf.data to implement this functionality.')
def _extract_labels(f, one_hot=False, num_classes=10):
  """Extract the labels into a 1D uint8 numpy array [index].

  Args:
    f: A file object that can be passed into a gzip reader.
    one_hot: Does one hot encoding for the result.
    num_classes: Number of classes for the one hot encoding.

  Returns:
    labels: a 1D uint8 numpy array.

  Raises:
    ValueError: If the bystream doesn't start with 2049.
  """
  print('Extracting', f.name)
  with gzip.GzipFile(fileobj=f) as bytestream:
    magic = _read32(bytestream)
    if magic != 2049:
      raise ValueError('Invalid magic number %d in MNIST label file: %s' %
                       (magic, f.name))
    num_items = _read32(bytestream)
    buf = bytestream.read(num_items)
    labels = numpy.frombuffer(buf, dtype=numpy.uint8)
    if one_hot:
      return _dense_to_one_hot(labels, num_classes)
    return labels


class _DataSet(object):
  """Container class for a _DataSet (deprecated).

  THIS CLASS IS DEPRECATED.
  """

  @deprecated(None, 'Please use alternatives such as official/mnist/_DataSet.py'
              ' from tensorflow/models.')
  def __init__(self,
               images,
               labels,
               fake_data=False,
               one_hot=False,
               dtype=dtypes.float32,
               reshape=True,
               seed=None):
    """Construct a _DataSet.

    one_hot arg is used only if fake_data is true.  `dtype` can be either
    `uint8` to leave the input as `[0, 255]`, or `float32` to rescale into
    `[0, 1]`.  Seed arg provides for convenient deterministic testing.

    Args:
      images: The images
      labels: The labels
      fake_data: Ignore inages and labels, use fake data.
      one_hot: Bool, return the labels as one hot vectors (if True) or ints (if
        False).
      dtype: Output image dtype. One of [uint8, float32]. `uint8` output has
        range [0,255]. float32 output has range [0,1].
      reshape: Bool. If True returned images are returned flattened to vectors.
      seed: The random seed to use.
    """
    seed1, seed2 = random_seed.get_seed(seed)
    # If op level seed is not set, use whatever graph level seed is returned
    numpy.random.seed(seed1 if seed is None else seed2)
    dtype = dtypes.as_dtype(dtype).base_dtype
    if dtype not in (dtypes.uint8, dtypes.float32):
      raise TypeError('Invalid image dtype %r, expected uint8 or float32' %
                      dtype)
    if fake_data:
      self._num_examples = 10000
      self.one_hot = one_hot
    else:
      assert images.shape[0] == labels.shape[0], (
          'images.shape: %s labels.shape: %s' % (images.shape, labels.shape))
      self._num_examples = images.shape[0]

      # Convert shape from [num examples, rows, columns, depth]
      # to [num examples, rows*columns] (assuming depth == 1)
      if reshape:
        assert images.shape[3] == 1
        images = images.reshape(images.shape[0],
                                images.shape[1] * images.shape[2])
      if dtype == dtypes.float32:
        # Convert from [0, 255] -> [0.0, 1.0].
        images = images.astype(numpy.float32)
        images = numpy.multiply(images, 1.0 / 255.0)
    self._images = images
    self._labels = labels
    self._epochs_completed = 0
    self._index_in_epoch = 0

  @property
  def images(self):
    return self._images

  @property
  def labels(self):
    return self._labels

  @property
  def num_examples(self):
    return self._num_examples

  @property
  def epochs_completed(self):
    return self._epochs_completed

  def next_batch(self, batch_size, fake_data=False, shuffle=True):
    """Return the next `batch_size` examples from this data set."""
    if fake_data:
      fake_image = [1] * 784
      if self.one_hot:
        fake_label = [1] + [0] * 9
      else:
        fake_label = 0
      return [fake_image for _ in xrange(batch_size)
             ], [fake_label for _ in xrange(batch_size)]
    start = self._index_in_epoch
    # Shuffle for the first epoch
    if self._epochs_completed == 0 and start == 0 and shuffle:
      perm0 = numpy.arange(self._num_examples)
      numpy.random.shuffle(perm0)
      self._images = self.images[perm0]
      self._labels = self.labels[perm0]
    # Go to the next epoch
    if start + batch_size > self._num_examples:
      # Finished epoch
      self._epochs_completed += 1
      # Get the rest examples in this epoch
      rest_num_examples = self._num_examples - start
      images_rest_part = self._images[start:self._num_examples]
      labels_rest_part = self._labels[start:self._num_examples]
      # Shuffle the data
      if shuffle:
        perm = numpy.arange(self._num_examples)
        numpy.random.shuffle(perm)
        self._images = self.images[perm]
        self._labels = self.labels[perm]
      # Start next epoch
      start = 0
      self._index_in_epoch = batch_size - rest_num_examples
      end = self._index_in_epoch
      images_new_part = self._images[start:end]
      labels_new_part = self._labels[start:end]
      return numpy.concatenate((images_rest_part, images_new_part),
                               axis=0), numpy.concatenate(
                                   (labels_rest_part, labels_new_part), axis=0)
    else:
      self._index_in_epoch += batch_size
      end = self._index_in_epoch
      return self._images[start:end], self._labels[start:end]


@deprecated(None, 'Please write your own downloading logic.')
def _maybe_download(filename, work_directory, source_url):
  """Download the data from source url, unless it's already here.

  Args:
      filename: string, name of the file in the directory.
      work_directory: string, path to working directory.
      source_url: url to download from if file doesn't exist.

  Returns:
      Path to resulting file.
  """
  if not gfile.Exists(work_directory):
    gfile.MakeDirs(work_directory)
  filepath = os.path.join(work_directory, filename)
  if not gfile.Exists(filepath):
    urllib.request.urlretrieve(source_url, filepath)
    with gfile.GFile(filepath) as f:
      size = f.size()
    print('Successfully downloaded', filename, size, 'bytes.')
  return filepath


@deprecated(None, 'Please use alternatives such as:'
            ' tensorflow_datasets.load(\'mnist\')')
def read_data_sets(train_dir,
                   fake_data=False,
                   one_hot=False,
                   dtype=dtypes.float32,
                   reshape=True,
                   validation_size=5000,
                   seed=None,
                   source_url=DEFAULT_SOURCE_URL):
  if fake_data:

    def fake():
      return _DataSet([], [],
                      fake_data=True,
                      one_hot=one_hot,
                      dtype=dtype,
                      seed=seed)

    train = fake()
    validation = fake()
    test = fake()
    return _Datasets(train=train, validation=validation, test=test)

  if not source_url:  # empty string check
    source_url = DEFAULT_SOURCE_URL

  train_images_file = 'train-images-idx3-ubyte.gz'
  train_labels_file = 'train-labels-idx1-ubyte.gz'
  test_images_file = 't10k-images-idx3-ubyte.gz'
  test_labels_file = 't10k-labels-idx1-ubyte.gz'

  local_file = _maybe_download(train_images_file, train_dir,
                               source_url + train_images_file)
  with gfile.Open(local_file, 'rb') as f:
    train_images = _extract_images(f)

  local_file = _maybe_download(train_labels_file, train_dir,
                               source_url + train_labels_file)
  with gfile.Open(local_file, 'rb') as f:
    train_labels = _extract_labels(f, one_hot=one_hot)

  local_file = _maybe_download(test_images_file, train_dir,
                               source_url + test_images_file)
  with gfile.Open(local_file, 'rb') as f:
    test_images = _extract_images(f)

  local_file = _maybe_download(test_labels_file, train_dir,
                               source_url + test_labels_file)
  with gfile.Open(local_file, 'rb') as f:
    test_labels = _extract_labels(f, one_hot=one_hot)

  if not 0 <= validation_size <= len(train_images):
    raise ValueError(
        'Validation size should be between 0 and {}. Received: {}.'.format(
            len(train_images), validation_size))

  validation_images = train_images[:validation_size]
  validation_labels = train_labels[:validation_size]
  train_images = train_images[validation_size:]
  train_labels = train_labels[validation_size:]

  options = dict(dtype=dtype, reshape=reshape, seed=seed)

  train = _DataSet(train_images, train_labels, **options)
  validation = _DataSet(validation_images, validation_labels, **options)
  test = _DataSet(test_images, test_labels, **options)

  return _Datasets(train=train, validation=validation, test=test)


二、解决报错ModuleNotFoundError: No module named ‘tensorflow.contrib‘

问题:在TensorFlow2.x版本已经不能使用contrib包

三、安装onnx报错assert CMAKE, ‘Could not find “cmake“ executable!‘

经过百度,查得:安装onnx需要protobuf编译所以安装前需要安装protobuf。

四、ImportError: cannot import name 'builder' from 'google.protobuf.internal'

问题:当运行torch转onnx的代码时,出现ImportError: cannot import name 'builder' from 'google.protobuf.internal',如下图:

原因:由于使用的google.protobuf版本太低而引起的。在较新的版本中,builder模块已经移动到了google.protobuf包中,而不再在google.protobuf.internal中。

解决办法:升级protobuf库

pip install --upgrade protobuf

五、解决ModuleNotFoundError: No module named 'sklearn'

问题:sklearn第三方库安装失败

原因:查看别人库的列表,发现sklearn的包名是scikit-learn

解决:安装scikit-learn,

pip install  -i https://pypi.tuna.tsinghua.edu.cn/simple scikit-learn

六、解决AttributeError: module ‘torch._C‘ has no attribute ‘_cuda_setDevice‘

网上查询原因:说我安装的torch是适合CPU的,而不是适合GPU的。于是我查询pytorch版本情况,代码如下,

import torch
torch.cuda.is_available()

结果是False。

显而易见,环境使用的是CPU版本的torch,但是我仔细检查了一下我安装的命令,如下

解决:下载三个安装包,适合GPU版本的,

可以参考这篇(1条消息) GPU版本安装Pytorch教程最新方法_pytorch gpu_水w的博客-CSDN博客

然后分别pip install 他们,这样就能够安装适合GPU版本的torch了。

七、解决ImportError: Missing optional dependency 'pytables'.  Use pip or conda to install pytables.

问题:运行py文件报错

解决历程:按照提示安装pytables,"pip install pytables"安装失败,然后试了"pip install tables"安装上了。

 重新运行代码,发现就不报错了。

八、解决AttributeError: module ‘distutils’ has no attribute ‘version’.

问题: AttributeError: module ‘distutils’ has no attribute ‘version’.

解决: setuptools版本问题”,版本过高导致的问题;setuptools版本

  • 第一步: pip uninstall setuptools【使用pip,不能使用 conda uninstall setuptools ; 【不能使用conda的命令,原因是,conda在卸载的时候,会自动分析与其相关的库,然后全部删除,如果y的话,整个环境都需要重新配置。
  • 第二步: pip或者conda install setuptools==59.5.0【现在最新的版本已经到了65了,之前的老版本只是部分保留,找不到的版本不行

然后重新运行了代码,发现没有报错了。

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

python 深度学习 解决遇到的报错问题 的相关文章

  • Python 的键盘中断不会中止 Rust 函数 (PyO3)

    我有一个使用 PyO3 用 Rust 编写的 Python 库 它涉及一些昂贵的计算 单个函数调用最多需要 10 分钟 从 Python 调用时如何中止执行 Ctrl C 好像只有执行结束后才会处理 所以本质上没什么用 最小可重现示例 Ca
  • Django 管理员在模型编辑时间歇性返回 404

    我们使用 Django Admin 来维护导出到我们的一些站点的一些数据 有时 当单击标准更改列表视图来获取模型编辑表单而不是路由到正确的页面时 我们会得到 Django 404 页面 模板 它是偶尔发生的 我们可以通过重新加载三次来重现它
  • Python(Selenium):如何通过登录重定向/组织登录登录网站

    我不是专业程序员 所以请原谅任何愚蠢的错误 我正在做一些研究 我正在尝试使用 Selenium 登录数据库来搜索大约 1000 个术语 我有两个问题 1 重定向到组织登录页面后如何使用 Selenium 登录 2 如何检索数据库 在我解决
  • 使用 matplotlib 绘制时间序列数据并仅在年初显示年份

    rcParams date autoformatter month b n Y 我正在使用 matpltolib 来绘制时间序列 如果我按上述方式设置 rcParams 则生成的图会在每个刻度处标记月份名称和年份 我怎样才能将其设置为仅在每
  • Flask 会话变量

    我正在用 Flask 编写一个小型网络应用程序 当两个用户 在同一网络下 尝试使用应用程序时 我遇到会话变量问题 这是代码 import os from flask import Flask request render template
  • 如何使用Conda下载python包并随后离线安装?

    我知道通过 pip 我可以使用以下命令下载 Python 包 但 pip install 破坏了我的内部包依赖关系 当我做 pip download
  • 根据列值突出显示数据框中的行?

    假设我有这样的数据框 col1 col2 col3 col4 0 A A 1 pass 2 1 A A 2 pass 4 2 A A 1 fail 4 3 A A 1 fail 5 4 A A 1 pass 3 5 A A 2 fail 2
  • 测试 python Counter 是否包含在另一个 Counter 中

    如何测试是否是pythonCounter https docs python org 2 library collections html collections Counter is 包含在另一个中使用以下定义 柜台a包含在计数器中b当且
  • 基于代理的模拟:性能问题:Python vs NetLogo & Repast

    我正在 Python 3 中复制一小段 Sugarscape 代理模拟模型 我发现我的代码的性能比 NetLogo 慢约 3 倍 这可能是我的代码的问题 还是Python的固有限制 显然 这只是代码的一个片段 但 Python 却花费了三分
  • 如何在ipywidget按钮中显示全文?

    我正在创建一个ipywidget带有一些文本的按钮 但按钮中未显示全文 我使用的代码如下 import ipywidgets as widgets from IPython display import display button wid
  • 使用 \r 并打印一些文本后如何清除控制台中的一行?

    对于我当前的项目 有一些代码很慢并且我无法使其更快 为了获得一些关于已完成 必须完成多少的反馈 我创建了一个进度片段 您可以在下面看到 当你看到最后一行时 sys stdout write r100 80 n I use 80覆盖最终剩余的
  • 如何在Python中对类别进行加权随机抽样

    给定一个元组列表 其中每个元组都包含一个概率和一个项目 我想根据其概率对项目进行采样 例如 给出列表 3 a 4 b 3 c 我想在 40 的时间内对 b 进行采样 在 python 中执行此操作的规范方法是什么 我查看了 random 模
  • 向 Altair 图表添加背景实心填充

    I like Altair a lot for making graphs in Python As a tribute I wanted to regenerate the Economist graph s in Mistakes we
  • 对年龄列进行分组/分类

    我有一个数据框说df有一个柱子 Ages gt gt gt df Age 0 22 1 38 2 26 3 35 4 35 5 1 6 54 我想对这个年龄段进行分组并创建一个像这样的新专栏 If age gt 0 age lt 2 the
  • 解释 Python 中的数字范围

    在 Pylons Web 应用程序中 我需要获取一个字符串 例如 关于如何做到这一点有什么建议吗 我是 Python 新手 我还没有找到任何可以帮助解决此类问题的东西 该列表将是 1 2 3 45 46 48 49 50 51 77 使用
  • 有人用过 Dabo 做过中型项目吗? [关闭]

    Closed 这个问题是基于意见的 help closed questions 目前不接受答案 我们正处于一个新的 ERP 风格的客户端 服务器应用程序的开始阶段 该应用程序是作为 Python 富客户端开发的 我们目前正在评估 Dabo
  • Python:如何将列表列表的元素转换为无向图?

    我有一个程序 可以检索 PubMed 出版物列表 并希望构建一个共同作者图 这意味着对于每篇文章 我想将每个作者 如果尚未存在 添加为顶点 并添加无向边 或增加每个合著者之间的权重 我设法编写了第一个程序 该程序检索每个出版物的作者列表 并
  • 如何解释tf.map_fn的结果?

    看代码 import tensorflow as tf import numpy as np elems tf ones 1 2 3 dtype tf int64 alternates tf map fn lambda x x x x el
  • 从列表指向字典变量

    假设你有一个清单 a 3 4 1 我想用这些信息来指向字典 b 3 4 1 现在 我需要的是一个常规 看到该值后 在 b 的位置内读写一个值 我不喜欢复制变量 我想直接改变变量b的内容 假设b是一个嵌套字典 你可以这样做 reduce di
  • 如何将输入读取为数字?

    这个问题的答案是社区努力 help privileges edit community wiki 编辑现有答案以改进这篇文章 目前不接受新的答案或互动 Why are x and y下面的代码中使用字符串而不是整数 注意 在Python 2

随机推荐

  • 灰色关联分析法

    与灰色预测模型一样 比赛不能优先使用 灰色关联往往可以与层次分析结合使用 层次分析用在确定权重上面 1 确定比较对象 评价对象 就是数据 并且需要进行规范化处理 就是标准化处理 见下面例题的表格数据 和参考数列 评价标准 一般该列数列都是1
  • windows下能搭建php-fpm吗 phpstudy

    这个Windows和Linux系统是不一样的 因为一般nginx搭配php需要php fpm中间件 但是Windows下需要第三方编译 下载的包里有php cgi exe 但不是php fpm如果想在windows上跑php fpm 据说可
  • 【ES】分布式集群

    ES 分布式集群 单节点集群 故障转移 水平扩容 应对故障 路由计算 本文主要参考尚硅谷的资料 少部分自己原创 有错误之处请指出 单节点集群 node 1001配置如下 集群名称 节点之间要保持一致 cluster name my elas
  • C++ PCL库实现最远点采样算法

    最远点采样 Farthest Point Sampling 简称FPS 是点云处理领域中的一种重要算法 用于对点云数据进行快速降采样 最早的最远点采样算法应该是在计算机图形学领域中提出的 用于在三维模型上进行表面重建 随着点云处理技术的发展
  • HDU--1200:To and Fro (字符串)

    1 题目源地址 http acm hdu edu cn showproblem php pid 1200 2 解题代码 include
  • 服务器远程使用什么协议,云服务器远程是什么协议

    云服务器远程是什么协议 内容精选 换一换 弹性云服务器 Elastic Cloud Server 是一种可随时自动获取 计算能力可弹性伸缩的云服务器 可帮助您打造可靠 安全 灵活 高效的应用环境 确保服务持久稳定运行 提升运维效率 WinS
  • Jira 史诗指南 (2022)

    Jira 就是为了完成工作 而 Epics 是实现该目标的一种有价值的方式 一般来说 Epics 适用于顾名思义 不会在一天内完成但会 的工作 史诗 在本指南中 我们将分解什么是 Epics 它们的用途 以及它们的用途 以及如何创建和使用它
  • Qt 应用程序显示页面的方法

    1 在qt窗口中显示页面 1 pro中添加 QT webkitwidgets 2 添加头文件 include
  • Swift4.0 guard,Array,Dictionary

    guard的使用 guard是Swift新增语法 guard语句必须带有else语句当条件表达式为true时候跳过else语句中的内容 执行语句组内容 条件表达式为false时候执行else语句中的内容 跳转语句一般是return brea
  • Web服务器群集:Nginx网页及安全优化

    目录 一 理论 1 Nginx网页优化 2 Nginx安全优化 3 Nginx日志分割 二 实验 1 网页压缩 2 网页缓存 3 连接超时设置 4 并发设置 5 隐藏版本信息 6 脚本实现每月1号进行日志分割 7 防盗链 三 总结 一 理论
  • 上海交大ACM班C++算法与数据结构——数据结构之栈

    上海交大ACM班C 算法与数据结构 数据结构之栈 1 栈的定义 后进先出LIFO first in last out 先进后出FILO first in last out 的线性表 有关线性表可查看 上海交大ACM班C 算法与数据结构 数据
  • HTML ,CSS ,JS 组合运用制作登录界面,注册界面,相册旋转展示界面,并相互跳转联系,源代码

    完成 个人相册 项目登录页面 要求 1 使用正则表达式验证邮箱 2 密码长度至少为6位且为字母与数字的组合 可自行改变背景图片 此时所用图片与项目在同一目录下 只需写入文件名 图片要在与项目同级目录下 要写入路径及名称 登录界面所有代码如下
  • PHP学习之路——基本语法

    phpinfo是一个函数 功能 这个函数 功能 会显示一个当前电脑 服务器 的详细的PHP信息 我们写完一段代码 就需要在后面加分号 php的代码部份全部要用半角的英文 很多人容易写成全角的英文和符号造成PHP代码报错 PHP中的变量也是如
  • CPU乱序执行

    CPU乱序执行 CPU乱序执行是什么 例程 参考 总结 CPU乱序执行是什么 我们理解的程序是顺序执行的 其实是指在单个独立的进程中表现得像顺序运行的 而多处理器多线程共享内存系统是十分复杂的 需要约束这些复杂系统的行为 我们将程序线程共享
  • mavon-editor 使用及如何将html的数据转为markdown的数据问题

    1 安装mavon editor cnpm install mavon editor s 2 页面使用
  • Python通过smtplib发送邮件

    Python通过smtplib发送邮件 1 邮件发送的步骤 2 邮箱设置 3 发送一封qq邮件 4 发送HTML格式的邮件 5 发送带附件的邮件 6 在HTML文本中添加图片 7 python给同一个人发送多封邮件 8 python给不同的
  • 5.6.2_IEEE754

    文章目录 一 引子 二 移码 1 移码与补码 2 移码本身 1 127 2 3 3 偏置值 普通情况 特殊情况 三 IEEE 754标准 1 格式 2 类型 1 短浮点数 2 double型 3 案例 1 案例一 2 案例二 4 范围 1
  • unity下多层随机迷宫构建

    using System Collections using System Collections Generic using UnityEngine public class Maze MonoBehaviour public GameO
  • 【Android入门到项目实战-- 11.4】—— ExoPlayer视频播放器框架的详细使用

    目录 什么是ExoPlayer 一 基本使用 1 添加依赖项 2 布局 3 Activity 二 自定义播放暂停 1 首先如何隐藏默认的开始暂停和快进 2 自定义 三 控制视频画面旋转和比例调整 四 全屏放大和缩小 1 双击视频放大缩小 2
  • python 深度学习 解决遇到的报错问题

    目录 一 解决报错ModuleNotFoundError No module named tensorflow examples 二 解决报错ModuleNotFoundError No module named tensorflow co