Python Tensorflow和Numpy缺失

Python Tensorflow和Numpy缺失,python,numpy,tensorflow,virtualenv,python-2.x,Python,Numpy,Tensorflow,Virtualenv,Python 2.x,我正在使用Ubuntu 14.04。我试图使用tensorflow模块,但尽管我已经安装了它,并且安装方式与安装任何其他pkg或模块的方式相同,但python并不认为它已安装。即使pip说它已经安装了。。。我不知道到底发生了什么事 你们自己看看: $ sudo pip install tensorflow The directory '/home/tex/.cache/pip/http' or its parent directory is not owned by the current us

我正在使用Ubuntu 14.04。我试图使用tensorflow模块,但尽管我已经安装了它,并且安装方式与安装任何其他pkg或模块的方式相同,但python并不认为它已安装。即使pip说它已经安装了。。。我不知道到底发生了什么事

你们自己看看:

$ sudo pip install tensorflow
The directory '/home/tex/.cache/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 '/home/tex/.cache/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 satisfied: tensorflow in /home/tex/.local/lib/python2.7/site-packages
Requirement already satisfied: six>=1.10.0 in /home/tex/.local/lib/python2.7/site-packages (from tensorflow)
Requirement already satisfied: markdown>=2.6.8 in /home/tex/.local/lib/python2.7/site-packages (from tensorflow)
Requirement already satisfied: bleach==1.5.0 in /home/tex/.local/lib/python2.7/site-packages (from tensorflow)
Requirement already satisfied: backports.weakref==1.0rc1 in /home/tex/.local/lib/python2.7/site-packages (from tensorflow)
Requirement already satisfied: html5lib==0.9999999 in /home/tex/.local/lib/python2.7/site-packages (from tensorflow)
Requirement already satisfied: werkzeug>=0.11.10 in /home/tex/.local/lib/python2.7/site-packages (from tensorflow)
Requirement already satisfied: mock>=2.0.0 in /home/tex/.local/lib/python2.7/site-packages (from tensorflow)
Requirement already satisfied: numpy>=1.11.0 in /home/tex/.local/lib/python2.7/site-packages (from tensorflow)
Requirement already satisfied: wheel in /usr/lib/python2.7/dist-packages (from tensorflow)
Requirement already satisfied: protobuf>=3.2.0 in /home/tex/.local/lib/python2.7/site-packages (from tensorflow)
Requirement already satisfied: funcsigs>=1; python_version < "3.3" in /home/tex/.local/lib/python2.7/site-packages (from mock>=2.0.0->tensorflow)
Requirement already satisfied: pbr>=0.11 in /home/tex/.local/lib/python2.7/site-packages (from mock>=2.0.0->tensorflow)
Requirement already satisfied: setuptools in /home/tex/.local/lib/python2.7/site-packages (from protobuf>=3.2.0->tensorflow)


编辑:不可能重复,因为发布的链接没有解决相同的问题。。。所以基本上,这是一个完全不同的问题。

仅仅因为您是virtualenv的源代码,这并不意味着'pip'命令将引用virtualenv的pip库。“pip”命令很可能仍然链接到默认的python解释器

您可以尝试以下操作以使其正常工作:

首先卸载两个模块:

[root@server] sudo pip uninstall tensorflow
[root@server] sudo pip uninstall numpy
然后找到你的虚拟电视:

[root@server] source ~/venv/activate
然后使用pip安装模块,同时显式调用python命令:

(venv)[root@server] python -m pip install tensorflow
(venv)[root@server] python -m pip install numpy
然后查看它们是否可用:

(venv)[root@server] python
>> import numpy

可能是@phd的重复不,我甚至不知道你为什么这么认为,甚至有些接近。那里的答案清楚地解释了什么时候应该使用
sudo
,什么时候应该使用
virtualenv
。你可以很容易地得到(而且你一定是谷歌搜索过)在虚拟环境中的
sudo
如果不是邪恶的话也是毫无意义的。您提到了在虚拟环境内外访问python模块的问题,但这正是虚拟环境所做的:从外部保护内部库。
[root@server] source ~/venv/activate
(venv)[root@server] python -m pip install tensorflow
(venv)[root@server] python -m pip install numpy
(venv)[root@server] python
>> import numpy