【问题标题】:Tensorflow won't work and it won't uninstall eitherTensorflow 不会工作,也不会卸载
【发布时间】:2017-09-17 16:39:19
【问题描述】:

所以你可以在这里看到我们有 python 和 anaconda

Python 3.6.1 |Anaconda 4.4.0 (x86_64)| (default, May 11 2017, 13:04:09) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

然后使用 pip3 和 tfBinaryURL 安装 Tensorflow,最终测试安装-

>>> #python
... import tensorflow as tf
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
ModuleNotFoundError: No module named 'tensorflow'
>>> 

所以我尝试使用 pip uninstall tensorflow 卸载 Tensorflow,但在 y/n 提示符(键入“y”)之后再次卸载

  Installing collected packages: tensorflow
  Found existing installation: tensorflow 1.3.0
  Uninstalling tensorflow-1.3.0:
Exception:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/shutil.py", line 544, in move
    os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/external/__pycache__/__init__.cpython-36.pyc' -> '/var/folders/61/1b15w21n0jbc2sndhd3j7xfr0000gn/T/pip-oepk4q_b-uninstall/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/external/__pycache__/__init__.cpython-36.pyc'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/shutil.py", line 559, in move
    os.unlink(src)
PermissionError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/external/__pycache__/__init__.cpython-36.pyc'

会发生这种情况。

如果它按照理想状态进行了预安装,那么程序 #1 应该可以工作 - 但它不能。

所以这次尝试通过 anaconda 进行安装,以防万一问题是由于不同版本的 Python -

    XXXs-MacBook-Pro:~ abi$ virtualenv --system-site-packages -p python3 ~/tensorflow
Running virtualenv with interpreter /Users/abi/anaconda/bin/python3
Using base prefix '/Users/abi/anaconda'
New python executable in /Users/abi/tensorflow/bin/python3
Also creating executable in /Users/abi/tensorflow/bin/python
dyld: Library not loaded: @rpath/libpython3.6m.dylib
  Referenced from: /Users/abi/tensorflow/bin/python3
  Reason: image not found
ERROR: The executable /Users/abi/tensorflow/bin/python3 is not functioning
ERROR: It thinks sys.prefix is '/Users/abi' (should be '/Users/abi/tensorflow')
ERROR: virtualenv is not compatible with this system or executable

你能帮忙吗?

【问题讨论】:

  • 我猜这是你的机器上有多个版本的 Python 的问题,并且使用 pip3 安装可能无法安装到你希望的 Python 上。不过我不完全确定。
  • 你试过sudo吗?

标签: python tensorflow anaconda


【解决方案1】:

试试这个看看:

conda install -c conda-forge tensorflow

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-25
    • 1970-01-01
    • 2017-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多