2.Rstudio里面可以使用R markdown,最后只好去

安装 rpy2 中的问题,安装rpy2问题

参考:

1、 的Redme.md

python3中  jupyter notebook中rpy2的安装:

1、先安装R和RStudio

2、安装 rpy2  参考:

  1)      这个网址中下载rpy2的whl包

  2)   通过pip install  xxx安装这个包,

  3)    python 中通过 import rpy2和  import rpy2.robjects as robjects 检查是否安装成功

3、安装后出现的问题的解决办法 参考:

    主要是要添加R_HOME 和R_USER的环境变量

4、jupyter notebook 中运行

      %load_ext rpy2.ipython

报错:AttributeError: 'ZMQInteractiveShell' object has no attribute 'has_readline'

找了很多资料找不到原因,最后是通过conda install rpy2  重新安装rpy2得以解决,可能是我之前安装的pip install whl版本不对

查看评论

rpy2 中的问题,安装rpy2问题 参考: 1、 python3中 jupyter notebook中rpy2的安装: 1、先安装R和...

R_USER:C:Anaconda3Libsite-packagesrpy2

%load_ext rpy2.ipython

前方高能 → Jupyter “import tensorflow” 的巨坑和如何填掉巨坑

因为是重点,所以一定要加粗
*开始以为装好了tensorflow,就可以在众星捧月的Jupyter Notebook里愉快玩耍Tensorflow了,结果是,把同样的代码写入到Jupyter Notebook里,它却告知我它没有引入Tensorflow这个模块,找了半天,终于找到了解决方案,赞!

TensorFlow website supports five installations.
To my understanding, using Pip installation directly would be fine to import TensorFlow in Jupyter Notebook (as long as Jupyter Notebook was installed and there were no other issues) b/z it didn't create any virtual environments.
Using virtualenv install and conda install would need to install jupyter into the newly created TensorFlow environment to allow TensorFlow to work in Jupyter Notebook (see the following original post section for more details).
I believe docker install may require some port setup in the VirtualBox to make TensorFlow work in Jupyter Notebook (see this post).
For installing from sources, it also depends on which environment the source code is built and installed into. If it's installed into a freshly created virtual environment or an virtual environment which didn't have Jupyter Notebook installed, it would also need to install Jupyter Notebook into the virtual environment to use Tensorflow in Jupyter Notebook.

To use tensorflow in Ipython and/or Jupyter(Ipython) Notebook, you'll need to install Ipython and Jupyter (after installing tensorflow) under the tensorflow activated environment.

Before install Ipython and Jupyter under tensorflow environment, if you do the following commands in terminal:
username$ source activate tensorflow
(tensorflow)username$ which ipython
(tensorflow)username$ /Users/username/anaconda/bin/ipython

(tensorflow)username$ which jupyter
(tensorflow)username$ /Users/username/anaconda/bin/jupyter

(tensorflow)username$ which python
(tensorflow)username$ /User/username//anaconda/envs/tensorflow/bin/python

This is telling you that when you open python from terminal, it is using the one installed in the "environments" where tensorflow is installed. Therefore you can actually import tensorflow successfully. However, if you are trying to run ipython and/or jupyter notebook, these are not installed under the "environments" equipped with tensorflow, hence it has to go back to use the regular environment which has no tensorflow module, hence you get an import error.
You can verify this by listing out the items under envs/tensorflow/bin directory:

(tensorflow) username$ conda list

You will see that there are no "ipython" and/or "jupyer" listing out.
To use tensorflow with Ipython and/or Jupyter notebook, simply install them into the tensorflow environment:

(tensorflow) username$ conda install ipython
(tensorflow) username$ pip install jupyter

After installing them, there should be a "jupyer" and a "ipython" show up in the envs/tensorflow/bin/ directory.

Notes: Before trying to import tensorflow module in jupyter notebook, try close the notebook. And "source deactivate tensorflow" first, and then reactivate it ("source activate tensorflow") to make sure things are "on the same page". Then reopen the notebook and try import tensorflow. It should be import successfully (worked on mine at least).

**重点就是,因为tensorflow的bin目录下并没有安装ipython和jupyter,所以它无法再jupyter notebook里正常import,需要额外安装ipython和jupyter包,安装成功后,通过 conda list命令可以看到jupyter和ipython。

最后关闭下开始打开的jupyter notebook,执行以下命令,再打开jupyter notebook即可。

source deactivate tensorflow
source activate tensorflow

以上。

3.添加进环境变量cmd命令

6。运行小程序,测试是否安装正确


从入门到动手感性实践,也就是准备一个Ubuntu的虚拟环境,再接上网络,各种下载和配置环境的过程。其实,整个过程真的很简单。

2、pip 安装jupyter 

说明R,RStudio都安装OK

install.packages('devtools')

devtools::install_github('IRkernel/IRkernel')

IRkernel::installspec()

Anaconda安装

虽然我现在也不确定是否正确念对了它的读音,但是因为它真的是众多大神推荐的旗舰款(包含很多数值计算的python包),先不管它的优缺点,撸下来再说吧。

安装步骤很简单:
在Anaconda官方网站下载跟系统对应的版本,例如,本人下载的是Anaconda3-5.0.1-Linux-x86_64.sh,运行命令安装

sudo bash Anaconda2-2.5.0-Linux-x86_64.sh

安装好以后,就使用conda命令对Anaconda进行管理(这个不是重点,可以不看conda这块命令使用)

  • 更新conda
conda update conda
  • 显示可用packages
conda list
  • 从conda安装package
conda install package-name
  • 删除package
conda remove package-name
  • 更新package
conda update package-name

五、测试

Error: Tried to guess R's HOME but no command 'R' in the PATH.

pip install rpy2

Tensorflow安装

前面讲了那么多跟Tensorflow无关的环境,现在终于到了重头戏了,然鹅,可能会比你想象中简单很多。因为我是虚拟机环境,没有真实的显卡,所以,只有放弃GPU的配置,选择了只有有CPU的Tensorflow。

  • 第一步: 参照官网的安装步骤
    具体来说就是如下:

    图片 1

    Installing with Anaconda

第二步:划下重点,这里会遇到一个坑,可能你到了第四步,你根本就下载不了这个cpu版本的tensorflow,因为你连不上googleapis.com,所以,你必须得可以翻墙出去,或者说其他的地方可以下载这个文件。

图片 2

Python3.6_Tensorflow只支持CPU的版本下载路径

因为我安装的是Python 3.6版本,所以我翻墙在官网上找到相对应的tensorflow的版本,并下载到本地windows系统,这里还有一个坑是,下载下来到windows系统的包是zip结尾的,,,但是,只需要稍微改成.whl结尾的包,就可以在Linux下愉快的安装了。
这里提供本人已经下载下来的版本地址,需要的朋友可以直接获取
链接:https://pan.baidu.com/s/1kXqvnin 密码:akv1

将下载下来的包放在Ubuntu后,执行安装命令如下,即可

pip install tensorflow-1.5.0-cp36-cp36m-linux_x86_64.whl

最后输入python代码验证下tensorflow是否安装成功?

import tensorflow as tf
sess = tf.Session()
a = tf.constant(10)
b = tf.constant(25)
print(sess.run(a + b ))

图片 3

安装成功!!!

=====================================================

保存这个python第三方库网站,网址是

去https://www.rstudio.com/products/rstudio/download/下载RStudio-1.1.419.exe,并安装。

http://news.hiapk.com/internet/s593427f2c668.html

参考链接,都非常棒

你为什么要用Jupyter进行分析,知乎答
第一次亲密接触Jupyter Notebook
Installing TensorFlow on Ubuntu
介绍Jupyter扩展插件的安装和使用
Trouble with TensorFlow in Jupyter Notebook

图片 4

简书App

4、打开了一个jupyter notebook 点击 file new 选择python 2版本输入下面代码 点击cell run ALL执行代码 

R_HOME:C:Program FilesRR-3.4.3

3.5 从R获取变量var:%R -o var

以下过程全是在Ubuntu系统下完成的!

  1. 先卸载旧版python和相应库,删除安装文件夹,要确保卸载干净

  2. 装2.7.13版本去官网找64位系统的安装文件,msi的后缀,装的时候不要选为所有用户要选仅对当前用户,我也没找到原因,经过几次尝试这个没有报错。

4。设置R_USER环境变量 (注意这个是rpy2的安装路径)

references:

自从混世大魔王给我安利了YJango的文章后,我就对深度学习着迷了,这说明,其实不是DL算法太难,而是讲算法的水平直接影响了观众是否继续的欲望,如果一个复杂的事情能简单描述,并再升华到人生哲理,啊!基本我就投降了。

  1. 从上面那个第三方库网站下载 numpy amd64的whl文件并保存到 c:python27scripts文件夹下(我默认装到C盘)

  2. cmd窗口 cd 到该文件夹,输入

    pip install numpy-xxxx+mkl-cp27-none-win_amd64.whl

Processing c:downnloadsrpy2-2.8.6-cp36-cp36m-win_amd64.whl

1.jupyter notebook之前是叫ipython notebook,升级后,不仅支持Python,还支持其他很多语言,如R,scala,go...

Jupyter Notebook

安装完毕以后,直接在terminal对话框里输入

Jupyter Notebook

将会启动传说中非常好用的Jupyter Notebook,每个输入和输出都可以记录下来,好用的magic外部语法命令,而且还可以支持40多种脚本语言,外加Markdown的文章说明,真是好到没朋友。呃呃呃。

图片 5

Jupyter Notebook大概长这样

上图中,左边一栏的目录结构,在读者默认安装后,并不会出现,而是需要额外安装一个插件才能看到,运行如下命令安装该插件,耐心等待安装,并重新打开jupyter notebook,你会看到

conda install -c conda-forge jupyter_contrib_nbextensions

图片 6

安装Nbextensions后Jupyter大概长这样

点击这个扩展栏,然后勾选Table of Contents(2),你再次打开你的笔记*.ipynb,就会看到如第一个图所示的左侧目录栏。

图片 7

勾选笔记内容目录形式

pip install pandas

本文由必威发布于必威-运维,转载请注明出处:2.Rstudio里面可以使用R markdown,最后只好去

相关阅读