tensorflow - 将代码从 Colab 转移到 Jupyter Notebook
问题描述
我尝试将一些代码从 Colab 转移到 Jupyter 笔记本。
Colab 中的代码是:
# Use some functions from tensorflow_docs
!pip install -q git+https://github.com/tensorflow/docs
我得到错误:
ERROR: Could not detect requirement name for 'git+https://github.com/tensorflow/docs', please specify one with #egg=your_package_name"
另外,如果它尝试不使用“!” 在一开始的时候:
pip install -q git+https://github.com/tensorflow/docs
我得到一个错误:
File "<ipython-input-11-8fda094c7d6e>", line 5
pip install -q git+https://github.com/tensorflow/docs
^
SyntaxError: invalid syntax
有人可以帮我吗?
解决方案
没有 ! 不作为!用于在 Jupyter iPython 环境中调用 bash shell。
我在 Google Cloud Platform Notebook(Jupyter Lab 版本 1.1.4)中尝试了使用 Python 版本(Python 3.5.3)的命令:
!pip3 install -q git+https://github.com/tensorflow/docs --user
并完美地工作。
!pip3 freeze | grep tensorflow
tensorflow==1.15.0
tensorflow-datasets==1.2.0
tensorflow-docs==0.0.0
tensorflow-estimator==1.15.1
tensorflow-hub==0.6.0
tensorflow-io==0.8.0
tensorflow-metadata==0.15.0
tensorflow-probability==0.8.0
tensorflow-serving-api==1.14.0
推荐阅读
- ruby-on-rails - 如何在 File.read() 中用 haml 替换 html
- tensorflow.js - tfjs codelab“从二维数据进行预测”在 tf-vis.render.scatterplot 中使用 values 关键字
- reactjs - 提交密码后如何渲染组件?
- pdf - Ghostscript 将 PDF 2 转换回 PDF 版本 1.7
- java - feign.RetryableException 包装了哪些异常?
- react-native - React Native 中 InputField 问题的 onChangeText
- flutter - 如何为输入选择创建与输入文本相同样式的新颤振组件?
- redux - 函数中的道具不调用该函数
- r - 如何在 R boxplot 函数中更改 y 轴刻度
- javascript - Google Drive API - 未列出特定的共享驱动器