简体   繁体   English

使用Windows和virtualenv在PyCharm中运行Docker(Tensorflow)

[英]Running Docker in PyCharm using Windows and virtualenv (Tensorflow)

I am trying to run Docker in my PyCharm project. 我正在尝试在我的PyCharm项目中运行Docker。 My PyCharm project uses Python 2.7, whereas the system default Python is 3.4. 我的PyCharm项目使用Python 2.7,而系统默认的Python是3.4。 I installed Docker through this tutorial. 我通过教程安装了Docker。 I start the Docker engine using in my virtual env of Python 2.7: 我在Python 2.7的虚拟环境中启动Docker引擎:

docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow

I can access it through my browser using http://192.168.99.101:8888 and it executes Python 2.7 code. 我可以使用http://192.168.99.101:8888通过浏览器访问它,它执行Python 2.7代码。

Now I want to use Docker in my existing PyCharm 2.7 project. 现在,我想在现有的PyCharm 2.7项目中使用Docker。 (note that I use Anaconda and that I use plenty of packages which I would like to keep). (请注意,我使用Anaconda,并且使用了大量我想保留的软件包)。

Is there any way to run the Tensorflow Docker Image in my PyCharm project? 有什么方法可以在我的PyCharm项目中运行Tensorflow Docker映像吗? (any other solution to run Tensorflow in PyCharm is fine as well). (在PyCharm中运行Tensorflow的任何其他解决方案也都可以)。

Yes, you can tell PyCharm to use a interpreter inside a docker container. 是的,您可以告诉PyCharm在Docker容器内使用解释器。 This, however, only works with PyCharm Professional. 但是,这仅适用于PyCharm Professional。

First, go to Preferences -> Project Interpreter (under Project: ...) and click on the gear or dots to the right of Project Interpreter near the top. 首先,转到“首选项”->“项目解释器” (在“项目:...”下),然后单击顶部附近“项目解释器”右侧的齿轮或点。 In the Configure Remote Python Interpreter dialog, click the Docker button. 在“ 配置远程Python解释器”对话框中,单击“ Docker”按钮。

https://blog.jetbrains.com/pycharm/2015/12/using-docker-in-pycharm/#make-pycharm-docker-interpreter https://blog.jetbrains.com/pycharm/2015/12/using-docker-in-pycharm/#make-pycharm-docker-interpreter

Follow this tutorial , particularly API section for api url. 请遵循本教程 ,尤其是关于API网址的API部分。 Below settings work fine for windows10. 以下设置适用于Windows10。

Note: works only with Professional Edition 注意:仅适用于专业版

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM