安装pytorch报错及解决

环境,win10,64位,Anaconda4.10.3,Cuda 9.2.148,cudnn应该为v7.4.2.24

其中在Anaconda中好像安装tensorflow-gpu 1.9 ,python3.7 64位,及32位虚拟python环境。

github 上找的此程序代码所需环境为3.5python

程序地址:

GitHub - MichalDanielDobrzanski/DeepLearningPython: neuralnetworksanddeeplearning.com integrated scripts for Python 3.5.2 and Theano with CUDA support

于是想再配置一个Python3.5的环境。现在安装了python3.5,想安装一个对应版本的tensorflow。网上查了说对应版本为tensorflow1.1.于是尝试安装此版本。

尝试命令:并指定其版本

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow==1.1

 报错为

尝试此链接中的程序安装tensorflow1.0:python - Unable to install tensorflow=1.0.0 - Stack Overflow

命令如下:

结果显示:

同时新问题出现了,tensorflow 不可用,并报错了,报错显示如上图。猜测可能版本不一样导致的。因此查找了具体版本和所能用的tensorflow。

版本匹配,及其命令具体如下:link:

tensorflow-gpu1.X版本和2.X版本详细安装流程(使用了清华的镜像源,包括cuda和cudnn安装)_一头特立独行的驴的博客-CSDN博客_cudnn镜像源

 在这里插入图片描述

 在纠错过程中,用到cuda的一些命令如下:

#cuda 常用命令
cd .. #返回上一目录,直到当前盘的根目录
D:   #直接输入盘符,切换目录
cd anaconda/envs/   #cd 加路径,可以切换到想去的路径

nvcc -V #查看 cuda 版本
conda info --envs  #查看conda 虚拟环境,结果的第一列为环境名
activate python37  #进入对应的虚拟环境,其中python37为环境名
python -V          #查看当前python版本

 然后尝试安装tensorflow 1.5.0:报错:

 尝试tensorlow 1.6.0版本,报错:总结为grpcio这个东西版本不对:然后根据链接:python 2.7 - Unable to install grpcio using pip install grpcio - Stack Overflow

进行跟新等操作。

Failed building wheel for grpcio
  Running setup.py clean for grpcio
  Running setup.py bdist_wheel for html5lib ... done
  Stored in directory: C:\Users\11327\AppData\Local\pip\Cache\wheels\11\b5\a5\84223095b1b4720df984fcea6e033580349dafca6034f2e491
Successfully built termcolor html5lib
Failed to build grpcio
Installing collected packages: astor, absl-py, werkzeug, html5lib, bleach, zipp, importlib-metadata, markdown, tensorboard, termcolor, grpcio, gast, tensorflow-gpu
  Running setup.py install for grpcio ... error
    Complete output from command D:\anaconda\envs\tf1.0\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\11327\\AppData\\Local\\Temp\\pip-install-bwp3jkup\\grpcio\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\11327\AppData\Local\Temp\pip-record-xp9hkq40\install-record.txt --single-version-externally-managed --compile:
    ASM Builds for BoringSSL currently not supported on: win-amd64
    Cython-generated files are missing...
    We could not find Cython. Setup may take 10-20 minutes.
    running install
    running build
    running build_py
    running build_project_metadata
    creating python_build
    creating python_build\lib.win-amd64-3.5
    creating python_build\lib.win-amd64-3.5\grpc
    copying src\python\grpcio\grpc\_auth.py -> python_build\lib.win-amd64-3.5\grpc
    copying src\python\grpcio\grpc\_channel.py -> python_build\lib.win-amd64-3.5\grpc
    copying src\python\grpcio\grpc\_common.py -> python_build\lib.win-amd64-3.5\grpc
    copying src\python\grpcio\grpc\_compression.py -> python_build\lib.win-amd64-3.5\grpc
    copying src\python\grpcio\grpc\_grpcio_metadata.py -> python_build\lib.win-amd64-3.5\grpc
    copying src\python\grpcio\grpc\_interceptor.py -> python_build\lib.win-amd64-3.5\grpc
    copying src\python\grpcio\grpc\_plugin_wrapping.py -> python_build\lib.win-amd64-3.5\grpc
    copying src\python\grpcio\grpc\_runtime_protos.py -> python_build\lib.win-amd64-3.5\grpc
    copying src\python\grpcio\grpc\_server.py -> python_build\lib.win-amd64-3.5\grpc
    copying src\python\grpcio\grpc\_simple_stubs.py -> python_build\lib.win-amd64-3.5\grpc
    copying src\python\grpcio\grpc\_utilities.py -> python_build\lib.win-amd64-3.5\grpc
    copying src\python\grpcio\grpc\__init__.py -> python_build\lib.win-amd64-3.5\grpc
    creating python_build\lib.win-amd64-3.5\grpc\aio
    copying src\python\grpcio\grpc\aio\_base_call.py -> python_build\lib.win-amd64-3.5\grpc\aio
    copying src\python\grpcio\grpc\aio\_base_channel.py -> python_build\lib.win-amd64-3.5\grpc\aio
    copying src\python\grpcio\grpc\aio\_base_server.py -> python_build\lib.win-amd64-3.5\grpc\aio
    copying src\python\grpcio\grpc\aio\_call.py -> python_build\lib.win-amd64-3.5\grpc\aio
    copying src\python\grpcio\grpc\aio\_channel.py -> python_build\lib.win-amd64-3.5\grpc\aio
    copying src\python\grpcio\grpc\aio\_interceptor.py -> python_build\lib.win-amd64-3.5\grpc\aio
    copying src\python\grpcio\grpc\aio\_metadata.py -> python_build\lib.win-amd64-3.5\grpc\aio
    copying src\python\grpcio\grpc\aio\_server.py -> python_build\lib.win-amd64-3.5\grpc\aio
    copying src\python\grpcio\grpc\aio\_typing.py -> python_build\lib.win-amd64-3.5\grpc\aio
    copying src\python\grpcio\grpc\aio\_utils.py -> python_build\lib.win-amd64-3.5\grpc\aio
    copying src\python\grpcio\grpc\aio\__init__.py -> python_build\lib.win-amd64-3.5\grpc\aio
    creating python_build\lib.win-amd64-3.5\grpc\beta
    copying src\python\grpcio\grpc\beta\implementations.py -> python_build\lib.win-amd64-3.5\grpc\beta
    copying src\python\grpcio\grpc\beta\interfaces.py -> python_build\lib.win-amd64-3.5\grpc\beta
    copying src\python\grpcio\grpc\beta\utilities.py -> python_build\lib.win-amd64-3.5\grpc\beta
    copying src\python\grpcio\grpc\beta\_client_adaptations.py -> python_build\lib.win-amd64-3.5\grpc\beta
    copying src\python\grpcio\grpc\beta\_metadata.py -> python_build\lib.win-amd64-3.5\grpc\beta
    copying src\python\grpcio\grpc\beta\_server_adaptations.py -> python_build\lib.win-amd64-3.5\grpc\beta
    copying src\python\grpcio\grpc\beta\__init__.py -> python_build\lib.win-amd64-3.5\grpc\beta
    creating python_build\lib.win-amd64-3.5\grpc\experimental
    copying src\python\grpcio\grpc\experimental\gevent.py -> python_build\lib.win-amd64-3.5\grpc\experimental
    copying src\python\grpcio\grpc\experimental\session_cache.py -> python_build\lib.win-amd64-3.5\grpc\experimental
    copying src\python\grpcio\grpc\experimental\__init__.py -> python_build\lib.win-amd64-3.5\grpc\experimental
    creating python_build\lib.win-amd64-3.5\grpc\framework
    copying src\python\grpcio\grpc\framework\__init__.py -> python_build\lib.win-amd64-3.5\grpc\framework
    creating python_build\lib.win-amd64-3.5\grpc\_cython
    copying src\python\grpcio\grpc\_cython\__init__.py -> python_build\lib.win-amd64-3.5\grpc\_cython
    creating python_build\lib.win-amd64-3.5\grpc\experimental\aio
    copying src\python\grpcio\grpc\experimental\aio\__init__.py -> python_build\lib.win-amd64-3.5\grpc\experimental\aio
    creating python_build\lib.win-amd64-3.5\grpc\framework\common
    copying src\python\grpcio\grpc\framework\common\cardinality.py -> python_build\lib.win-amd64-3.5\grpc\framework\common
    copying src\python\grpcio\grpc\framework\common\style.py -> python_build\lib.win-amd64-3.5\grpc\framework\common
    copying src\python\grpcio\grpc\framework\common\__init__.py -> python_build\lib.win-amd64-3.5\grpc\framework\common
    creating python_build\lib.win-amd64-3.5\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\abandonment.py -> python_build\lib.win-amd64-3.5\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\callable_util.py -> python_build\lib.win-amd64-3.5\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\future.py -> python_build\lib.win-amd64-3.5\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\logging_pool.py -> python_build\lib.win-amd64-3.5\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\stream.py -> python_build\lib.win-amd64-3.5\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\stream_util.py -> python_build\lib.win-amd64-3.5\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\__init__.py -> python_build\lib.win-amd64-3.5\grpc\framework\foundation
    creating python_build\lib.win-amd64-3.5\grpc\framework\interfaces
    copying src\python\grpcio\grpc\framework\interfaces\__init__.py -> python_build\lib.win-amd64-3.5\grpc\framework\interfaces
    creating python_build\lib.win-amd64-3.5\grpc\framework\interfaces\base
    copying src\python\grpcio\grpc\framework\interfaces\base\base.py -> python_build\lib.win-amd64-3.5\grpc\framework\interfaces\base
    copying src\python\grpcio\grpc\framework\interfaces\base\utilities.py -> python_build\lib.win-amd64-3.5\grpc\framework\interfaces\base
    copying src\python\grpcio\grpc\framework\interfaces\base\__init__.py -> python_build\lib.win-amd64-3.5\grpc\framework\interfaces\base
    creating python_build\lib.win-amd64-3.5\grpc\framework\interfaces\face
    copying src\python\grpcio\grpc\framework\interfaces\face\face.py -> python_build\lib.win-amd64-3.5\grpc\framework\interfaces\face
    copying src\python\grpcio\grpc\framework\interfaces\face\utilities.py -> python_build\lib.win-amd64-3.5\grpc\framework\interfaces\face
    copying src\python\grpcio\grpc\framework\interfaces\face\__init__.py -> python_build\lib.win-amd64-3.5\grpc\framework\interfaces\face
    creating python_build\lib.win-amd64-3.5\grpc\_cython\_cygrpc
    copying src\python\grpcio\grpc\_cython\_cygrpc\__init__.py -> python_build\lib.win-amd64-3.5\grpc\_cython\_cygrpc
    creating python_build\lib.win-amd64-3.5\grpc\_cython\_credentials
    copying src\python\grpcio\grpc\_cython\_credentials\roots.pem -> python_build\lib.win-amd64-3.5\grpc\_cython\_credentials
    running build_ext
    Non-fatal exception:Traceback (most recent call last):
      File "C:\Users\11327\AppData\Local\Temp\pip-install-bwp3jkup\grpcio\src\python\grpcio\commands.py", line 239, in compiler_ok_with_extra_std
        stderr=subprocess.PIPE)
      File "D:\anaconda\envs\tf1.0\lib\subprocess.py", line 676, in __init__
        restore_signals, start_new_session)
      File "D:\anaconda\envs\tf1.0\lib\subprocess.py", line 957, in _execute_child
        startupinfo)
    FileNotFoundError: [WinError 2] 系统找不到指定的文件。

    Cython-generated files are missing...
    Compiling src\python\grpcio\grpc/_cython/cygrpc.pyx because it changed.
    [1/1] Cythonizing src\python\grpcio\grpc/_cython/cygrpc.pyx
    c:\users\11327\appdata\local\temp\pip-install-bwp3jkup\grpcio\.eggs\cython-3.0.0a10-py3.5.egg\Cython\Compiler\Main.py:346: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: C:\Users\11327\AppData\Local\Temp\pip-install-bwp3jkup\grpcio\src\python\grpcio\grpc\_cython\cygrpc.pxd
      tree = Parsing.p_module(s, pxd, full_module_name)
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:20:0: Dotted filenames ('_cygrpc/arguments.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:21:0: Dotted filenames ('_cygrpc/call.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:22:0: Dotted filenames ('_cygrpc/channel.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:23:0: Dotted filenames ('_cygrpc/credentials.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:24:0: Dotted filenames ('_cygrpc/completion_queue.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:25:0: Dotted filenames ('_cygrpc/event.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:26:0: Dotted filenames ('_cygrpc/metadata.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:27:0: Dotted filenames ('_cygrpc/operation.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:28:0: Dotted filenames ('_cygrpc/propagation_bits.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:29:0: Dotted filenames ('_cygrpc/records.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:30:0: Dotted filenames ('_cygrpc/security.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:31:0: Dotted filenames ('_cygrpc/server.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:32:0: Dotted filenames ('_cygrpc/tag.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:33:0: Dotted filenames ('_cygrpc/time.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:34:0: Dotted filenames ('_cygrpc/vtable.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:35:0: Dotted filenames ('_cygrpc/_hooks.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:37:0: Dotted filenames ('_cygrpc/iomgr.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:39:0: Dotted filenames ('_cygrpc/grpc_gevent.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:45:0: Dotted filenames ('_cygrpc/aio/completion_queue.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:46:0: Dotted filenames ('_cygrpc/aio/rpc_status.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:47:0: Dotted filenames ('_cygrpc/aio/grpc_aio.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:48:0: Dotted filenames ('_cygrpc/aio/callback_common.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:49:0: Dotted filenames ('_cygrpc/aio/call.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:50:0: Dotted filenames ('_cygrpc/aio/channel.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pxd:51:0: Dotted filenames ('_cygrpc/aio/server.pxd.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:39:0: Dotted filenames ('_cygrpc/grpc_string.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:40:0: Dotted filenames ('_cygrpc/arguments.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:41:0: Dotted filenames ('_cygrpc/call.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:42:0: Dotted filenames ('_cygrpc/channel.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:43:0: Dotted filenames ('_cygrpc/channelz.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:44:0: Dotted filenames ('_cygrpc/csds.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:45:0: Dotted filenames ('_cygrpc/credentials.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:46:0: Dotted filenames ('_cygrpc/completion_queue.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:47:0: Dotted filenames ('_cygrpc/event.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:48:0: Dotted filenames ('_cygrpc/metadata.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:49:0: Dotted filenames ('_cygrpc/operation.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:50:0: Dotted filenames ('_cygrpc/propagation_bits.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:51:0: Dotted filenames ('_cygrpc/records.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:52:0: Dotted filenames ('_cygrpc/security.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:53:0: Dotted filenames ('_cygrpc/server.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:54:0: Dotted filenames ('_cygrpc/tag.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:55:0: Dotted filenames ('_cygrpc/time.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:56:0: Dotted filenames ('_cygrpc/vtable.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:57:0: Dotted filenames ('_cygrpc/_hooks.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:59:0: Dotted filenames ('_cygrpc/iomgr.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:61:0: Dotted filenames ('_cygrpc/grpc_gevent.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:63:0: Dotted filenames ('_cygrpc/thread.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:66:4: Dotted filenames ('_cygrpc/fork_windows.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:71:0: Dotted filenames ('_cygrpc/aio/common.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:72:0: Dotted filenames ('_cygrpc/aio/rpc_status.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:73:0: Dotted filenames ('_cygrpc/aio/completion_queue.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:74:0: Dotted filenames ('_cygrpc/aio/callback_common.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:75:0: Dotted filenames ('_cygrpc/aio/grpc_aio.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:76:0: Dotted filenames ('_cygrpc/aio/call.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:77:0: Dotted filenames ('_cygrpc/aio/channel.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    warning: src\python\grpcio\grpc\_cython\cygrpc.pyx:78:0: Dotted filenames ('_cygrpc/aio/server.pyx.pxi') are deprecated. Please use the normal Python package directory layout.
    building 'grpc._cython.cygrpc' extension
    Traceback (most recent call last):
      File "C:\Users\11327\AppData\Local\Temp\pip-install-bwp3jkup\grpcio\src\python\grpcio\commands.py", line 285, in build_extensions
        build_ext.build_ext.build_extensions(self)
      File "D:\anaconda\envs\tf1.0\lib\distutils\command\build_ext.py", line 448, in build_extensions
        self._build_extensions_serial()
      File "D:\anaconda\envs\tf1.0\lib\distutils\command\build_ext.py", line 473, in _build_extensions_serial
        self.build_extension(ext)
      File "D:\anaconda\envs\tf1.0\lib\site-packages\setuptools\command\build_ext.py", line 199, in build_extension
        _build_ext.build_extension(self, ext)
      File "D:\anaconda\envs\tf1.0\lib\distutils\command\build_ext.py", line 533, in build_extension
        depends=ext.depends)
      File "D:\anaconda\envs\tf1.0\lib\distutils\_msvccompiler.py", line 304, in compile
        self.initialize()
      File "D:\anaconda\envs\tf1.0\lib\distutils\_msvccompiler.py", line 197, in initialize
        vc_env = _get_vc_env(plat_spec)
      File "D:\anaconda\envs\tf1.0\lib\site-packages\setuptools\msvc.py", line 185, in msvc14_get_vc_env
        return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
      File "D:\anaconda\envs\tf1.0\lib\site-packages\setuptools\msvc.py", line 1227, in return_env
        [self.VCIncludes,
      File "D:\anaconda\envs\tf1.0\lib\site-packages\setuptools\msvc.py", line 876, in VCIncludes
        return [os.path.join(self.si.VCInstallDir, 'Include'),
      File "D:\anaconda\envs\tf1.0\lib\site-packages\setuptools\msvc.py", line 555, in VCInstallDir
        raise distutils.errors.DistutilsPlatformError(msg)
    distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\11327\AppData\Local\Temp\pip-install-bwp3jkup\grpcio\setup.py", line 542, in <module>
        cmdclass=COMMAND_CLASS,
      File "D:\anaconda\envs\tf1.0\lib\site-packages\setuptools\__init__.py", line 140, in setup
        return distutils.core.setup(**attrs)
      File "D:\anaconda\envs\tf1.0\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "D:\anaconda\envs\tf1.0\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "D:\anaconda\envs\tf1.0\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "D:\anaconda\envs\tf1.0\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "D:\anaconda\envs\tf1.0\lib\distutils\command\install.py", line 539, in run
        self.run_command('build')
      File "D:\anaconda\envs\tf1.0\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "D:\anaconda\envs\tf1.0\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "D:\anaconda\envs\tf1.0\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "D:\anaconda\envs\tf1.0\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "D:\anaconda\envs\tf1.0\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "D:\anaconda\envs\tf1.0\lib\site-packages\setuptools\command\build_ext.py", line 78, in run
        _build_ext.run(self)
      File "D:\anaconda\envs\tf1.0\lib\distutils\command\build_ext.py", line 339, in run
        self.build_extensions()
      File "C:\Users\11327\AppData\Local\Temp\pip-install-bwp3jkup\grpcio\src\python\grpcio\commands.py", line 288, in build_extensions
        support.diagnose_build_ext_error(self, error, formatted_exception)
      File "C:\Users\11327\AppData\Local\Temp\pip-install-bwp3jkup\grpcio\src\python\grpcio\support.py", line 115, in diagnose_build_ext_error
        "backtrace).\n\n{}".format(formatted))
    commands.CommandError:

    We could not diagnose your build failure. If you are unable to proceed, please file an issue at http://www.github.com/grpc/grpc with `[Python install]` in the title; please attach the whole log (including everything that may have appeared above the Python backtrace).

    Traceback (most recent call last):
      File "C:\Users\11327\AppData\Local\Temp\pip-install-bwp3jkup\grpcio\src\python\grpcio\commands.py", line 285, in build_extensions
        build_ext.build_ext.build_extensions(self)
      File "D:\anaconda\envs\tf1.0\lib\distutils\command\build_ext.py", line 448, in build_extensions
        self._build_extensions_serial()
      File "D:\anaconda\envs\tf1.0\lib\distutils\command\build_ext.py", line 473, in _build_extensions_serial
        self.build_extension(ext)
      File "D:\anaconda\envs\tf1.0\lib\site-packages\setuptools\command\build_ext.py", line 199, in build_extension
        _build_ext.build_extension(self, ext)
      File "D:\anaconda\envs\tf1.0\lib\distutils\command\build_ext.py", line 533, in build_extension
        depends=ext.depends)
      File "D:\anaconda\envs\tf1.0\lib\distutils\_msvccompiler.py", line 304, in compile
        self.initialize()
      File "D:\anaconda\envs\tf1.0\lib\distutils\_msvccompiler.py", line 197, in initialize
        vc_env = _get_vc_env(plat_spec)
      File "D:\anaconda\envs\tf1.0\lib\site-packages\setuptools\msvc.py", line 185, in msvc14_get_vc_env
        return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
      File "D:\anaconda\envs\tf1.0\lib\site-packages\setuptools\msvc.py", line 1227, in return_env
        [self.VCIncludes,
      File "D:\anaconda\envs\tf1.0\lib\site-packages\setuptools\msvc.py", line 876, in VCIncludes
        return [os.path.join(self.si.VCInstallDir, 'Include'),
      File "D:\anaconda\envs\tf1.0\lib\site-packages\setuptools\msvc.py", line 555, in VCInstallDir
        raise distutils.errors.DistutilsPlatformError(msg)
    distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/


    ----------------------------------------
Command "D:\anaconda\envs\tf1.0\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\11327\\AppData\\Local\\Temp\\pip-install-bwp3jkup\\grpcio\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\11327\AppData\Local\Temp\pip-record-xp9hkq40\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\11327\AppData\Local\Temp\pip-install-bwp3jkup\grpcio\
You are using pip version 10.0.1, however version 20.3.4 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

 出错:仅选取最后几行(报错实在太多了)

 File "C:\Users\11327\AppData\Local\Temp\pip-install-v1o1zqw3\grpcio\src\python\grpcio\commands.py", line 288, in build_extensions
        support.diagnose_build_ext_error(self, error, formatted_exception)
      File "C:\Users\11327\AppData\Local\Temp\pip-install-v1o1zqw3\grpcio\src\python\grpcio\support.py", line 117, in diagnose_build_ext_error
        diagnostic(build_ext, error)
      File "C:\Users\11327\AppData\Local\Temp\pip-install-v1o1zqw3\grpcio\src\python\grpcio\support.py", line 97, in diagnose_attribute_error
        "We expect a missing `_needs_stub` attribute from older versions of "
    commands.CommandError: We expect a missing `_needs_stub` attribute from older versions of setuptools. Consider upgrading setuptools.

    ----------------------------------------
Command "D:\anaconda\envs\tf1.0\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\11327\\AppData\\Local\\Temp\\pip-install-v1o1zqw3\\grpcio\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\11327\AppData\Local\Temp\pip-record-jgypeq1u\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\11327\AppData\Local\Temp\pip-install-v1o1zqw3\grpcio\

 然后安装其指定prpcio==1.36.1

pip3 install --no-cache-dir  --force-reinstall -Iv grpcio==1.36.1

 然后就安装成功了,

tensorflow 1.6.0安装成功,但是 依旧不能用(好傻呀这个问题),

Installing collected packages: gast, tensorflow-gpu
Successfully installed gast-0.5.3 tensorflow-gpu-1.6.0
You are using pip version 10.0.1, however version 20.3.4 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

(tf1.0) D:\anaconda\envs\tf1.0>import tensorflow as tf
'import' is not recognized as an internal or external command,
operable program or batch file.

要切换到python环境里用tensorflow,上述是在a command line里面运行

所以切换到python,试试tensorflow,报错如下,(这个错误似曾相识)

>>> import tensorflow as tf
D:\anaconda\envs\tf1.0\lib\site-packages\tensorflow\python\framework\dtypes.py:517: 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)])
D:\anaconda\envs\tf1.0\lib\site-packages\tensorflow\python\framework\dtypes.py:518: 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)])
D:\anaconda\envs\tf1.0\lib\site-packages\tensorflow\python\framework\dtypes.py:519: 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)])
D:\anaconda\envs\tf1.0\lib\site-packages\tensorflow\python\framework\dtypes.py:520: 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)])
D:\anaconda\envs\tf1.0\lib\site-packages\tensorflow\python\framework\dtypes.py:521: 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)])
D:\anaconda\envs\tf1.0\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_resource = np.dtype([("resource", np.ubyte, 1)])

 回想之前用python3.7 tensorflow 1.9直接运行数字识别程序时出错:

runfile('E:/work/DeepLearningPython-master/test.py', wdir='E:/work/DeepLearningPython-master')
WARNING (theano.configdefaults): g++ not available, if using conda: `conda install m2w64-toolchain`
D:\anaconda\envs\python37\lib\site-packages\theano\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory
  warnings.warn("DeprecationWarning: there is no c++ compiler."
WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
Trying to run under a GPU.  If this is not desired, then modify network3.py
to set the GPU flag to False.
D:\anaconda\envs\python37\lib\site-packages\theano\tensor\nnet\conv.py:98: UserWarning: theano.tensor.nnet.conv.conv2d is deprecated. Use theano.tensor.nnet.conv2d instead.
  warnings.warn("theano.tensor.nnet.conv.conv2d is deprecated."
Training mini-batch number 0
D:\anaconda\envs\python37\lib\site-packages\theano\tensor\signal\pool.py:574: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  yk[[region_slices[i][r[i]] for i in xrange(nd)]])
D:\anaconda\envs\python37\lib\site-packages\theano\tensor\signal\pool.py:574: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  yk[[region_slices[i][r[i]] for i in xrange(nd)]])
D:\anaconda\envs\python37\lib\site-packages\theano\tensor\signal\pool.py:574: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  yk[[region_slices[i][r[i]] for i in xrange(nd)]])
D:\anaconda\envs\python37\lib\site-packages\theano\tensor\signal\pool.py:574: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  yk[[region_slices[i][r[i]] for i in xrange(nd)]])
D:\anaconda\envs\python37\lib\site-packages\theano\tensor\signal\pool.py:574: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  yk[[region_slices[i][r[i]] for i in xrange(nd)]])
D:\anaconda\envs\python37\lib\site-packages\theano\tensor\signal\pool.py:574: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  yk[[region_slices[i][r[i]] for i in xrange(nd)]])
D:\anaconda\envs\python37\lib\site-packages\theano\tensor\signal\pool.py:574: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  yk[[region_slices[i][r[i]] for i in xrange(nd)]])
D:\anaconda\envs\python37\lib\site-packages\theano\tensor\signal\pool.py:574: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  yk[[region_slices[i][r[i]] for i in xrange(nd)]])
Traceback (most recent call last):

  File "C:\Users\11327\AppData\Local\Temp/ipykernel_16896/1828017625.py", line 1, in <module>
    runfile('E:/work/DeepLearningPython-master/test.py', wdir='E:/work/DeepLearningPython-master')

  File "D:\anaconda\envs\python37\lib\site-packages\debugpy\_vendored\pydevd\_pydev_bundle\pydev_umd.py", line 167, in runfile
    execfile(filename, namespace)

  File "D:\anaconda\envs\python37\lib\site-packages\debugpy\_vendored\pydevd\_pydev_imps\_pydev_execfile.py", line 25, in execfile
    exec(compile(contents + "\n", file, 'exec'), glob, loc)

  File "E:/work/DeepLearningPython-master/test.py", line 210, in <module>
    net.SGD(training_data, 60, mini_batch_size, 0.03, validation_data, test_data, lmbda=0.1)

  File "E:\work\DeepLearningPython-master\network3.py", line 163, in SGD
    cost_ij = train_mb(minibatch_index)

  File "D:\anaconda\envs\python37\lib\site-packages\theano\compile\function_module.py", line 903, in __call__
    self.fn() if output_subset is None else\

  File "D:\anaconda\envs\python37\lib\site-packages\theano\gof\vm.py", line 301, in __call__
    thunk()

  File "D:\anaconda\envs\python37\lib\site-packages\theano\gof\op.py", line 892, in rval
    r = p(n, [x[0] for x in i], o)

  File "D:\anaconda\envs\python37\lib\site-packages\theano\tensor\elemwise.py", line 790, in perform
    variables = ufunc(*ufunc_args, **ufunc_kwargs)

  File "D:\anaconda\envs\python37\lib\site-packages\theano\scalar\basic.py", line 4023, in impl
    self.perform(None, inputs, output_storage)

  File "D:\anaconda\envs\python37\lib\site-packages\theano\scalar\basic.py", line 4019, in perform
    storage[0] = impl(inputs)

  File "D:\anaconda\envs\python37\lib\site-packages\theano\scalar\basic.py", line 3891, in f
    return node.op.impl(*[p(inputs) for p in producers])

  File "D:\anaconda\envs\python37\lib\site-packages\theano\scalar\basic.py", line 1748, in impl
    return np.product(inputs)

  File "<__array_function__ internals>", line 6, in product

  File "D:\anaconda\envs\python37\lib\site-packages\numpy\core\fromnumeric.py", line 3751, in product
    return prod(*args, **kwargs)

  File "<__array_function__ internals>", line 6, in prod

  File "D:\anaconda\envs\python37\lib\site-packages\numpy\core\fromnumeric.py", line 3052, in prod
    keepdims=keepdims, initial=initial, where=where)

KeyboardInterrupt

见下一篇博文,安装pytorch报错及解决。END 

  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
根据提供的引用内容\[1\],可以看出在安装pytorch时出现了错误。错误信息显示找不到满足要求的torch版本,也没有找到匹配的分发版本。同时还有一个警告,检查pip的最新版本时出现了错误。 这个错误可能有几个原因导致: 1. 网络连接问题:请确保你的网络连接正常,可以尝试重新运行安装命令。 2. 源问题:你使用的源可能无法找到所需的torch版本。你可以尝试更换源,或者使用官方源进行安装。 3. 系统兼容性问题:请确保你的系统满足pytorch的最低要求。例如,某些版本的pytorch可能需要特定的操作系统或CUDA版本。 为了解决这个问题,你可以尝试以下几个步骤: 1. 检查网络连接:确保你的网络连接正常,可以尝试重新运行安装命令。 2. 更换源:尝试使用官方源进行安装,可以使用以下命令: ``` pip3 install torch torchvision torchaudio ``` 3. 检查系统兼容性:确保你的系统满足pytorch的最低要求。你可以查看pytorch官方文档或者官方网站上的系统要求。 如果问题仍然存在,请提供更多的错误信息或者尝试在相关的开发者社区或者论坛上寻求帮助。 #### 引用[.reference_title] - *1* [安装pytorch报错](https://blog.csdn.net/oHuanCheng/article/details/130065955)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值