使用Virtualenv安装TensorFlow时出现PermissionError [英] PermissionError While Installing TensorFlow Using Virtualenv

查看:155
本文介绍了使用Virtualenv安装TensorFlow时出现PermissionError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用virtualenv安装tensorflow.以下命令可以正常工作.

I was installing tensorflow using virtualenv. The following commands worked fine.

$ virtualenv ~/.tensorflow/bin/activate
$ pip install --upgrade tensorflow

但是,如果我尝试:

$ virtualenv ~/.tensorflow/bin/activate
$ pip3 install tensorflow

我收到PermissionError:

I got PermissionError:

我用sudo尝试了最后一条命令.

I tried the last command with sudo.

$ sudo pip3 install tensorflow

然后看来我可以将tensorflow导入virtualenv之外. (对吗?)

Then it seems like I can import tensorflow outside virtualenv. (Is it correct?)

如何仅在virtualenv内为python 3安装tensorflow?

How can I install tensorflow for python 3 only inside virtualenv?

顺便说一句,我为python 2.7.12和3.5.2使用了pip 9.0.1.

By the way, I am using pip 9.0.1 for both python 2.7.12 and 3.5.2.

virtualenv的版本是15.0.1.

The version of virtualenv is 15.0.1.

推荐答案

对于python2:

$ virtualenv --system-site-packages ~/.tensorflow
$ source ~/.tensorflow/bin/activate
(.tensorflow)$ pip install --upgrade tensorflow

对于python3:

$ virtualenv -p python3.5 --system-site-packages ~/.tensorflow3
$ source ~/.tensorflow3/bin/activate
(.tensorflow3)$ pip3 install --upgrade tensorflow

使用这些方法,我可以仅在virtualenvs内部成功安装tensorflow.

Using these ways, I could successfully install tensorflow only inside virtualenvs.

非常感谢@AshokaLella!

Thank you so much @AshokaLella!

这篇关于使用Virtualenv安装TensorFlow时出现PermissionError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆