使用 tensorflow 我遇到了这样的错误

Posted 鍒樻爧

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用 tensorflow 我遇到了这样的错误相关的知识,希望对你有一定的参考价值。

Installing collected packages: numpy, scipy, six, pyyaml, Keras, opencv-python, h5py, html5lib, bleach, futures, wheel, werkzeug, markdown, protobuf, tensorflow-tensorboard, pbr, funcsigs, mock, backports.weakref, tensorflow
  Found existing installation: numpy 1.14.1
    Uninstalling numpy-1.14.1:
      Successfully uninstalled numpy-1.14.1
  Found existing installation: scipy 0.13.0b1
    DEPRECATION: Uninstalling a distutils installed project (scipy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling scipy-0.13.0b1:
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
    copy2(src, real_dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
    copystat(src, dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
    os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: ‘/tmp/pip-k6sIvY-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy-0.13.0b1-py2.7.egg-info‘

  

首先我想到的是目录权限的问题,于是一通的修改 不知道执行了多少次的 ```chmod 755``` 结果没有任何卵用;

那是不是因为 目录归属有问题呢? 又是一通修改 ```chown usename``` 结果还是没有用;

最后只好谷歌了,搜到这篇文章:https://www.jianshu.com/p/7a18c78b5982, yes 他解决了我的问题,只需要小小的升级下旧的包就可以搞定了,这里把执行的命令记录如下:

$ pip install --upgrade pip

$ sudo pip install numpy --upgrade --ignore-installed
$ sudo pip install scipy --upgrade --ignore-installed
$ sudo pip install scikit-learn --upgrade --ignore-installed

  

 

以上是关于使用 tensorflow 我遇到了这样的错误的主要内容,如果未能解决你的问题,请参考以下文章

Tensorflow.keras:AlreadyExistsError

Tensorflow 中没有变量可以保存错误

Tensorflow:feed_dict 的形状错误

如何更改 gpt-2 代码以使用 Tensorflow 2.0?

Tensorflow 未检测到 CUDA 设备

Tensorflow 值错误:变量已存在,不允许