我通过VMWare安装了Ubuntu 14.04。 我在virtualenv中安装了tensorflow,我将它导入pycharm并使用它没有问题。 今天我开始使用pycharm,看起来这是我第一次启动它。然后,当我试图运行我上个月运行的python文件并且它无效时,请说:
Traceback (most recent call last):
File "/home/user/PycharmProjects/TensorFlowTutorials/mnist_beginner.py", line 1, in <module>
from tensorflow.examples.tutorials.mnist import input_data
ImportError: No module named tensorflow.examples.tutorials.mnist
然后我尝试通过sudo pip install tensorflow
安装它(不知道为什么,因为它是上个月安装的),它说:
The directory '/home/user/.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/user/.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.
Collecting tensorflow
/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
**Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow**
/usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
知道是什么导致了这个吗?
答案 0 :(得分:0)
听起来你的配置已被吹走,其中包括已配置的Python路径。由于您使用的是virtualenv,因此您需要配置PyCharm以在项目设置&gt;下使用它。 Project Interpreter并选择或浏览virtualenv中的Python可执行文件。