我最近被强烈安利了 Jupyter Notebook 这个交互式笔记本。然后试用了它自带的 Python 内核后,这个应用整体给我的感觉很不错,就去搜索了下它所支持的其它内核 Jupyter Kernels。我在下面内容介绍下该应用下如何安装 PHP 内核。

安装步骤

安装 PHP 内核 Jupyter-PHP

环境要求

  1. PHP >= 7.0
  2. 已安装 Jupyter Notebook
  3. Mac 上操作

步骤

  1. 全局安装 Composer


    $ curl -sS https://getcomposer.org/installer | php
    $ mv composer.phar /usr/local/bin/composer
  2. 安装 PHP-ZMQ 扩展

    (1) 下载编译


    $ git clone git://github.com/mkoppanen/php-zmq.git $ cd php-zmq $ phpize && ./configure $ make && make install

    (2)修改配置


    修改 php.ini 配置,添加 `extension=/path/modules/zmq.so`
  3. 下载 jupyter-php-installer.phar
  4. 执行 phar 安装程序

    $ php jupyter-php-installer.phar install

  5. 安装成功,显示 The Jupyter-PHP kernel has been successfully installed.

遇到并解决的问题

问题 1:

编译 PHP-ZMQ 无 autoconf 和 pkg-config

解决:


$ brew install autoconf
$ brew install pkg-config

问题 2:

Mac 上无 php.ini

解决:


$ sudo cp /etc/php.ini.default /etc/php.ini

问题 3:

编译的扩展 zmq.so 无法移动到 PHP 默认扩展路径 /usr/lib/php/extensions/no-debug-non-zts-20160303/

解决:

因为 macOS 系统完整性保护(SIP)将阻止你将 zmq.so 移动到默认路径下,而我又不想关闭SIP。所以处理办法是引入扩展写入绝对路径



        extension=/path/modules/zmq.so

问题 4:

使用 PHP 内核 并 print 打印出现了双输出

解决:

实际是因为它将打印的值和返回值无差别的输出导致的,而作者暂未解决。查看 issues

原文地址:https://segmentfault.com/a/1190000016107828

Jupyter Notebook 下安装 PHP 内核的更多相关文章

  1. Jupyter Notebook 介绍 安装和使用技巧

    Jupyter Notebook介绍.安装及使用教程 原文链接:https://www.jianshu.com/p/91365f343585 目录一.什么是Jupyter Notebook? 1. 简 ...

  2. Jupyter Notebook环境安装

    Jupyter Notebook环境安装 一.什么是jupyter Notebook 1.简介 Jupyter Notebook 是基于网页的用于交互计算机的应用程序器可被应用程序. 能让用户将说明文 ...

  3. python环境搭建以及jupyter notebook的安装和启动

    一.Python 环境搭建 本章节我们将向大家介绍如何在本地搭建Python开发环境. Python可应用于多平台包括 Linux 和 Mac OS X. 你可以通过终端窗口输入 "pyth ...

  4. python ipython notebook或者 jupyter notebook 的安装

    IPython Notebook使用浏览器作为界面,向后台的IPython服务器发送请求,并显示结果.在浏览器的界面中使用单元(Cell)保存各种信息.Cell有多种类型,经常使用的有表示格式化文本的 ...

  5. 在windows下安装Jupyter Notebook的安装和使用

    1 认识jupyter jupyter /ˈdʒuːpɪtə(r)/可以提供适合捕捉整个计算过程的基于web的应用程序:开发.记录和执行代码,以及结果输出. jupyter Notebook提供了两个 ...

  6. Linux Ubuntu下Jupyter Notebook的安装

    Jupyter Notebook, 以前又称为IPython notebook,是一个交互式笔记本, 支持运行40+种编程语言. 可以用来编写漂亮的交互式文档. 安装步骤: pip install - ...

  7. Ubuntu下Jupyter Notebook的安装

    pip install --upgrade pip //更新pip pip install jupyter sudo apt install jupyter-notebook 运行 jupyter-n ...

  8. jupyter notebook下python2和python3共存(Ubuntu)

    提示NOTICE 时间:2018/04/06 主题:Ubuntu 下CAFFE框架 主角:Jupyter Notebook 简介: Jupyter Notebook(此前被称为 IPython not ...

  9. jupyter notebook的安装与使用

    一.jupyter notebool介绍 Jupyter Notebook是Ipython的升级版,而Ipython可以说是一个加强版的交互式 Shell,也就是说,它比在terminal里运行pyt ...

随机推荐

  1. [C++设计模式] decorator 装饰者模式

    <head first>中 的样例:咖啡店有各种咖啡饮料,能够往咖啡里面加各种调料变成还有一种饮料.假设使用继承的方式来为每一种饮料设计一个类,代码的复杂度非常easy膨胀,并且会继承父类 ...

  2. UVA - 10324 Zeros and Ones

    Description Given a string of 0's and 1's up to 1000000 characters long and indices i and j, you are ...

  3. Codesys——PLCopen基本运动控制功能块的使用方法总结

    MC_Halt 在MC_MoveVelocity模式下,用MC_Halt停止其轴,当前轴的状态由 ContinuousMotion(当前转速)--->DiscreteMotion(速度不为0)- ...

  4. AAC的ADTS头文件信息介绍

    遵循:BY-SA 署名-相同方式共享 4.0协议   作者:谭东 时间:2016年10月28日 环境:Windows 7   ADTS是Audio Data Transport Stream的简称. ...

  5. opensStack

  6. mkisofs

    createrepo -g /enp/comps.xml . yum -y --downloadonly --downloaddir=/enp/Packages upgrade mkisofs -o ...

  7. Coursera Algorithms week3 快速排序 练习测验: Selection in two sorted arrays(从两个有序数组中寻找第K大元素)

    题目原文 Selection in two sorted arrays. Given two sorted arrays a[] and b[], of sizes n1 and n2, respec ...

  8. hadoop-Combiner作用用法

    文章来源http://blog.csdn.net/ipolaris/article/details/8723782 reduce的输入每个key所对应的value将是一大串1,但处理的文本很多时,这一 ...

  9. thinkphp关联操作

    比如:你要求删除用户的时候,同时删除与用户有关的所有信息. 一对一:  有 (HAS_ONE)   属于 (BELONGS_TO)    一对多:  有 (HAS_MANY)  属于 (BELONG_ ...

  10. [Swift通天遁地]九、拔剑吧-(11)创建强大的Pinterest风格的瀑布流界面

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...