我的问题:
这里是 ML 领域的新手。我目前正在尝试通过 docker 设置 tensorflow,但是一旦 tensorflow 似乎正在运行,我在访问 jupyter notebook 时遇到了一些麻烦。为了将来引用,我使用的是 Windows 10、powershell、python 2.7 和 oracle virtualbox (v.5.0.16)。
我非常有信心 docker 工作正常,因为我完成了他们的设置教程(“使用 Powershell 中的 docker”)没有任何问题——我能够在那里运行 hello world 示例。我还能够使用命令成功运行 ubuntu 终端
docker run -it ubuntu bash
然后我关注了tensorflow docker installation instructions一切似乎都很正常——我输入了 tensorflow 的 docker run 命令:
docker run -it b.gcr.io/tensorflow/tensorflow
得到这个输出:
[I 19:33:16.330 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[W 19:33:16.360 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[W 19:33:16.360 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using authentication. This is highly insecure and not recommended.
[I 19:33:16.365 NotebookApp] Serving notebooks from local directory: /notebooks
[I 19:33:16.365 NotebookApp] 0 active kernels
[I 19:33:16.365 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/
[I 19:33:16.366 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
但是,当我尝试访问位于 localhost:8888 的 jupyter notebook 时,chrome 表示无法在几秒钟内访问该站点并且服务器拒绝连接。
我尝试过的解决方案:
遵循了 this stackoverflow post 中的建议.当我运行他们建议启动新的 tensorflow 容器的命令时,出现错误:
exec: "./run_jupyter.sh": stat ./run_jupyter.sh: no such file or directory
docker: Error response from daemon: Container command not found or does not exist..
我还按照他们的建议使用 virtualbox 更改了端口设置,这似乎也没有什么不同。
我没有使用本地主机,而是在使用命令 docker-machine ls 时尝试了为驱动程序列出的 IP 地址。这里也不走运。
我的第一次尝试是使用 docker 附带的 quickstart 终端,但我卡在了同一个地方。所以现在我有一个“默认值”,从我使用快速启动终端设置 docker 开始,还有一个“我的默认值”,从我使用 powershell 设置 docker 开始。 Stackexchange 评论说 quickstart 终端不如使用 powershell 那么好,所以我开始使用 powershell。
尝试使用 docker-machine env 更改激活的驱动程序,然后为该驱动程序的 IP 地址运行 tensorflow run 命令,但仍然没有成功。
尝试跳过 jupyter notebook 并按照 tensorflow 安装下一步的建议(“从命令行运行 tensorflow”)通过 python 从命令行运行所有内容,但我什至无法从那里导入 tensorflow :
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named tensorflow
如果不先运行 jupyter,我不知道这是否可行,但我认为值得一试。这个问题可能与这篇文章所讨论的问题无关,但如果有人知道这是为什么,那也会有所帮助。
我感谢提供的所有帮助。如果我所说的任何内容含糊不清,或者我是否可以提供有关我尝试过的内容的更多详细信息,请告诉我。非常感谢你提前。
最佳答案
尝试将 -p 8888:888 添加到 docker run 命令。
docker run -p 8888:8888 -it b.gcr.io/tensorflow/tensorflow
找到解决方案 in this tensorflow issue ,在 HWiese1980 的评论中
Since Docker usually needs to have the same operating system on the Docker host system as it's in the Docker container (well, parts that is) you need a Linux VM to run a Docker container that is based on Linux under Windows. Docker itself opens port 8888 between the VM and the container. You have to explicitly tell it to forward the port from the outside of the VM to the open Docker container port by using said parameter -p 8888:8888.
关于windows - 尝试通过 Docker 运行 TensorFlow 时难以访问 Jupyter notebook,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36226872/
总的来说,我对ruby还比较陌生,我正在为我正在创建的对象编写一些rspec测试用例。许多测试用例都非常基础,我只是想确保正确填充和返回值。我想知道是否有办法使用循环结构来执行此操作。不必为我要测试的每个方法都设置一个assertEquals。例如:describeitem,"TestingtheItem"doit"willhaveanullvaluetostart"doitem=Item.new#HereIcoulddotheitem.name.shouldbe_nil#thenIcoulddoitem.category.shouldbe_nilendend但我想要一些方法来使用
类classAprivatedeffooputs:fooendpublicdefbarputs:barendprivatedefzimputs:zimendprotecteddefdibputs:dibendendA的实例a=A.new测试a.foorescueputs:faila.barrescueputs:faila.zimrescueputs:faila.dibrescueputs:faila.gazrescueputs:fail测试输出failbarfailfailfail.发送测试[:foo,:bar,:zim,:dib,:gaz].each{|m|a.send(m)resc
我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0
我正在用Ruby编写一个简单的程序来检查域列表是否被占用。基本上它循环遍历列表,并使用以下函数进行检查。require'rubygems'require'whois'defcheck_domain(domain)c=Whois::Client.newc.query("google.com").available?end程序不断出错(即使我在google.com中进行硬编码),并打印以下消息。鉴于该程序非常简单,我已经没有什么想法了-有什么建议吗?/Library/Ruby/Gems/1.8/gems/whois-2.0.2/lib/whois/server/adapters/base.
尝试通过RVM将RubyGems升级到版本1.8.10并出现此错误:$rvmrubygemslatestRemovingoldRubygemsfiles...Installingrubygems-1.8.10forruby-1.9.2-p180...ERROR:Errorrunning'GEM_PATH="/Users/foo/.rvm/gems/ruby-1.9.2-p180:/Users/foo/.rvm/gems/ruby-1.9.2-p180@global:/Users/foo/.rvm/gems/ruby-1.9.2-p180:/Users/foo/.rvm/gems/rub
在选择我想要运行操作的频率时,唯一的选项是“每天”、“每小时”和“每10分钟”。谢谢!我想为我的Rails3.1应用程序运行调度程序。 最佳答案 这不是一个优雅的解决方案,但您可以安排它每天运行,并在实际开始工作之前检查日期是否为当月的第一天。 关于ruby-如何每月在Heroku运行一次Scheduler插件?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/8692687/
exe应该在我打开页面时运行。异步进程需要运行。有什么方法可以在ruby中使用两个参数异步运行exe吗?我已经尝试过ruby命令-system()、exec()但它正在等待过程完成。我需要用参数启动exe,无需等待进程完成是否有任何rubygems会支持我的问题? 最佳答案 您可以使用Process.spawn和Process.wait2:pid=Process.spawn'your.exe','--option'#Later...pid,status=Process.wait2pid您的程序将作为解释器的子进程执行。除
我有一个包含模块的模型。我想在模块中覆盖模型的访问器方法。例如:classBlah这显然行不通。有什么想法可以实现吗? 最佳答案 您的代码看起来是正确的。我们正在毫无困难地使用这个确切的模式。如果我没记错的话,Rails使用#method_missing作为属性setter,因此您的模块将优先,阻止ActiveRecord的setter。如果您正在使用ActiveSupport::Concern(参见thisblogpost),那么您的实例方法需要进入一个特殊的模块:classBlah
我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r
我正在使用puppet为ruby程序提供一组常量。我需要提供一组主机名,我的程序将对其进行迭代。在我之前使用的bash脚本中,我只是将它作为一个puppet变量hosts=>"host1,host2"我将其提供给bash脚本作为HOSTS=显然这对ruby不太适用——我需要它的格式hosts=["host1","host2"]自从phosts和putsmy_array.inspect提供输出["host1","host2"]我希望使用其中之一。不幸的是,我终其一生都无法弄清楚如何让它发挥作用。我尝试了以下各项:我发现某处他们指出我需要在函数调用前放置“function_”……这