anconda安装后命令行中安装tensorflow报错

现象  anconda安装后命令行中安装tensorflow报错

pip install --upgrade --ignore-installed tensorflow-gpu

 

Building wheels for collected packages: absl-py, termcolor, wrapt, gast, opt-ein
sum
  Building wheel for absl-py (setup.py) ... done
  Stored in directory: C:\Users\s00361549\AppData\Local\pip\Cache\wheels\6f\98\d
6\8bd50820f7d43519b30165d851aaab78b2c4c6b41a8b5954ce
  Building wheel for termcolor (setup.py) ... done
  Stored in directory: C:\Users\s00361549\AppData\Local\pip\Cache\wheels\b4\20\f
8\ba53c72a3b5da8c516ea0ecd4cc68013d1157d110a9521fb28
  Building wheel for wrapt (setup.py) ... done
  Stored in directory: C:\Users\s00361549\AppData\Local\pip\Cache\wheels\55\35\9
8\b76052d08675d50d1e7b508ed7de7fea7c7424d9deb9a37da8
  Building wheel for gast (setup.py) ... done
  Stored in directory: C:\Users\s00361549\AppData\Local\pip\Cache\wheels\97\f0\f
6\fbd69e8bb2aa2f48c213b623006798293b1b336c471d27ae20
  Building wheel for opt-einsum (setup.py) ... done
  Stored in directory: C:\Users\s00361549\AppData\Local\pip\Cache\wheels\94\01\5
9\207eaeb0a43cfe369934952731a8df146cc7d12062e1af2095
Successfully built absl-py termcolor wrapt gast opt-einsum
ERROR: astroid 2.2.5 requires typed-ast>=1.3.0; implementation_name == "cpython"
, which is not installed.

Installing collected packages: six, absl-py, termcolor, wrapt, astor, setuptools
, wheel, protobuf, markdown, grpcio, werkzeug, numpy, tensorboard, gast, google-
pasta, h5py, keras-applications, keras-preprocessing, opt-einsum, tensorflow-est
imator, tensorflow-gpu
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒绝
访问。: 'C:\\ProgramData\\Anaconda3\\Lib\\site-packages\\numpy\\core\\_multiarra
y_tests.cp37-win_amd64.pyd'

Consider using the `--user` option or check the permissions.

 

二   原因 

用 pip install tensorflow 方法解决

参考

先安装下cpython,或者用pip install tensorflow

https://ask.csdn.net/questions/780058

继续用tensorflow 执行唐宇迪线性回归代码报错如下:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-1c0af2ee5701> in <module>
----> 1 import numpy as np
      2 import tensorflow as tf
      3 import matplotlib.pyplot as plt
      4 
      5 #1 构造待模拟线性回归的点

C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py in <module>
    140     from . import _distributor_init
    141 
--> 142     from . import core
    143     from .core import *
    144     from . import compat

C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\__init__.py in <module>
     93 from . import numerictypes as nt
     94 multiarray.set_typeDict(nt.sctypeDict)
---> 95 from . import numeric
     96 from .numeric import *
     97 from . import fromnumeric

C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\numeric.py in <module>
     33 from ._exceptions import TooHardError, AxisError
     34 from ._asarray import asarray, asanyarray
---> 35 from ._ufunc_config import errstate
     36 
     37 bitwise_not = invert

ModuleNotFoundError: No module named 'numpy.core._ufunc_config'

解决方法:

参考 https://blog.csdn.net/THmen/article/details/88376575

若未安装numpy库(tensorflow需要numpy支持),先安装numpy;若已安装,则需要更新numpy至最新版本:

>> pip install numpy
>> pip install -U numpy
 
#或使用conda安装
 
>> conda list numpy #查看是否安装numpy
>> conda install numpy
>> conda update numpy
 
#建议索性全部更新
 
>> conda update --all
 

 

  • 1
    点赞
  • 0
    评论
  • 1
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 我行我“速” 设计师:Amelia_0503 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值