I try to install tensorflow via virtualenv in mac, the reference is here:
因为我已经有了 python,所以我通过以下方式安装 virtualenv:
sudo pip install --upgrade virtualenv
在
~/development project/tensorflow
中构建新的 virtualenv 环境,不在~/tensorflow
中正如引用文献中所述:virtualenv --system-site-packages ~/development project/tensorflow
cd ~/development project/tensorflow
活跃虚拟环境:
source bin/activate # if use bash,and I choose this line to run
当我在 virtualenv 中并运行此命令时:
(tensorflow)$ pip install --upgrade <$url_to_binary.whl>
出现错误:
zsh: parse error near '\n'
then I check here to help solve it 它说
<$url_to_binary.whl>
应替换为https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl
,我就这么做了。问题就解决了。但是,当我尝试通过 cd 测试 tensorflow 时, tensorflow 中的某个目录如下:
(tensorflow)$ cd tensorflow/models/image/mnist
该目录不存在。
所以我猜是我修改的网址造成的,我尝试重新安装 virtualenv 和 tensorflow,以使我的安装干净。
tensorflow 已成功卸载,但是当我删除 virtualenv 时,它会突然出现:
Exception: Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/usr/local/lib/python2.7/site-packages/pip/commands/uninstall.py", line 76, in run requirement_set.uninstall(auto_confirm=options.yes) File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 346, in uninstall req.uninstall(auto_confirm=auto_confirm) File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 754, in uninstall paths_to_remove.remove(auto_confirm) File "/usr/local/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove renames(path, new_path) File "/usr/local/lib/python2.7/site-packages/pip/utils/init.py", line 267, in renames shutil.move(old, new) File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 303, in move os.unlink(src) OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/virtualenv-15.1.0.dist-info/DESCRIPTION.rst'
- 我删除目录
tensorflow
目前我无法卸载 virtualenv,也无法安装它,但它仍然存在......这确实是连线的。
如果我运行
sudo pip install --upgrade virtualenv
它再次说道:
The directory '/Users/Calvino/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/Users/Calvino/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Requirement already up-to-date: virtualenv in /usr/local/lib/python2.7/site-packages
我的问题是如何彻底删除 virtualenv 和 tensorflow 并重新安装它们。
如果有人能提供帮助,我将不胜感激。
最佳答案
已经两年了,但无论如何你需要卸载> //使用新的 SO 更新重新安装 python 2 或 3
brew update
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
brew reinstall python@3
然后重新安装tensorflow> https://www.tensorflow.org/install/pip
关于tensorflow - mac 下卸载 virtualenv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43708413/