如何在Jupyter Notebook中使用Tensorflow

Using a virtualenv in an IPython notebook

You can use a virtualenv for your IPython notebook. Follow the following steps:

Install the ipython kernel module into your virtualenv
也可使用conda env

workon my-virtualenv-name  # activate your virtualenv, if you haven't already
# or activate env-name
pip install ipykernel

Now run the kernel “self-install” script:

python -m ipykernel install --user --name={my-virtualenv-name}

Replacing the –name parameter as appropriate.

You should now be able to see your kernel in the IPython notebook menu: Kernel -> Change kernel and be able so switch to it (you may need to refresh the page before it appears in the list). IPython will remember which kernel to use for that notebook from then on.

jupyter 启动报错 Permission denied: ‘/run/user/0/jupyter’
解决办法:
将/root/.jupyter 目录复制到 /home/long/.jupyter目录下(long是我的用户名),修改权限为755

    chown long:long .jupyter
    chmod 755 -R .jupyter

然后在/etc/profile 中添加下面这行:

export XDG_RUNTIME_DIR='/home/long/.jupyter'

执行source /etc/profile, 使修改生效。
可以参考:python +jupyter (python3.5) 实现词云(png)

centos7安装jupyter并配置多个Python版本切换

做完上面的工作之后,我们就可以在Jupyter NoteBook中使用下面的方法使用该env环境了.
这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值