[英]Pycharm and virtual environment
I created virtual environment called tensorflow
in Anaconda. 我在Anaconda中创建了一个名为
tensorflow
虚拟环境。
Now I would like to use it in Pycharm (I have 2017 version of Pycharm) 现在我想在Pycharm中使用它(我有Pycharm的2017版本)
In Pycharm in project interpreter I selected standard Anaconda interpreter. 在Pycharm的项目解释器中,我选择了标准的Anaconda解释器。 In terminal inside Pycharm I typed
activate tensorflow
and it successfully activated, but when I try to run import tensorflow as tf
it generates error: No module named 'tensorflow'
在Pycharm内部的终端中,我输入了
activate tensorflow
并成功激活了它,但是当我尝试在import tensorflow as tf
运行import tensorflow as tf
它会生成错误: No module named 'tensorflow'
I already searched and tried everything in SO. 我已经搜索并尝试了SO中的所有内容。 I have virtual env.
我有虚拟环境。 enabled in tools -> terminal.
在工具->终端中启用。
Any thoughts? 有什么想法吗?
Addition: I have not problem using this virtual environment within jupyter notebook. 另外:在jupyter笔记本中使用此虚拟环境没有问题。
Instead of activating your interpreter in Pycharm, you should select your interpreter from the environment you just created. 与其在Pycharm中激活解释器,不如从刚创建的环境中选择解释器。 Basically, when you create a new project, you should select your interpreter from the virtual environment as opposed to the standard anaconda environment.
基本上,在创建新项目时,应该从虚拟环境中选择解释器,而不是标准的anaconda环境。 An example is shown in the picture below:
下图显示了一个示例:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.