pycharm中jupyter的使用图文教程

步骤

1、安装Jupyter

pip install jupyter

2、 新建一个IPython文件

3、在Terminal里启动Jupyter Notebook

4、 编写程序

随便写点什么测试一下,应该得到的结果是这样的:

print(1) 

点击运行!

填入上面的地址即可

补充:Linux下安装Pycharm和jupyter

Linux下python

CentOS7下默认

安装python3

默认情况下 CentOS7 系统中自带的 Python 版本是2.7版本。我们当前工作的Python版本几乎全为 Python3 版本,所以可以通过 yum 软件包管理工具安装python3版本, 不过由

于 CentOS7 的 Base 软件包仓库默认没有 Python3版本 ,因此查找失败,

[root@localhost ~]# yum list "*python3*"
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * extras: mirrors.163.com
 * updates: mirrors.163.com
Error: No matching Packages to list

除了 Base 仓库,还可以使用 epel 仓库,要想使用 epel 仓库,需要先安装一下 epel 仓库,安装过程如下

[root@localhost ~]# yum install epel-release -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.njupt.edu.cn
 * extras: mirrors.163.com
 * updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                Arch             Version         Repository        Size
================================================================================
Installing:
 epel-release           noarch           7-11            extras            15 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 15 k
Installed size: 24 k
Downloading packages:
warning: /var/cache/yum/x86_64/7/extras/packages/epel-release-7-11.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for epel-release-7-11.noarch.rpm is not installed
epel-release-7-11.noarch.rpm                               |  15 kB   00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-5.1804.el7.centos.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-11.noarch                                     1/1
  Verifying  : epel-release-7-11.noarch                                     1/1 

Installed:
  epel-release.noarch 0:7-11                                                    

Complete!

epel 仓库安装完毕后,使用 yum 命令再次查询 python3 ,发现有多个不同版本的 python3软件包。

root@localhost ~]# yum list "*python3*"
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                     | 7.1 kB     00:00
 * base: centos.ustc.edu.cn
 * epel: mirrors.yun-idc.com
 * extras: mirrors.163.com
 * updates: centos.ustc.edu.cn
epel                                                     | 4.7 kB     00:00
(1/3): epel/x86_64/group_gz                                |  88 kB   00:00
(2/3): epel/x86_64/updateinfo                              | 1.0 MB   00:03
(3/3): epel/x86_64/primary_db                              | 6.6 MB   00:05
Available Packages
abrt-addon-python3.noarch                2.1.11-49.el7                      epel
boost-python34.x86_64                    1.53.0-28.el7                      epel
boost-python34-devel.x86_64              1.53.0-28.el7                      epel
python3-urjtag.x86_64                    2017.10-2.el7                      epel
python3-virtualenv-doc.noarch            15.1.0-2.el7                       epel
python34.x86_64                          3.4.9-2.el7                        epel
python34-Cython.x86_64                   0.23.5-1.el7                       epel
python34-PyMySQL.noarch                  0.9.2-1.el7                        epel
python34-PyYAML.x86_64                   3.11-3.el7                         epel
·
·省略部分软件包信息.......
·
python34-aiosmtpd.noarch                 1.0-2.el7                          epel
python34-zope-interface.x86_64           4.3.3-1.el7                        epel
python34-zope-schema.noarch              4.4.1-2.el7                        epel
python34-zope-testing.noarch             4.1.2-2.el7                        epel
python36.x86_64                          3.6.6-2.el7                        epel
python36-PyYAML.x86_64                   3.11-3.el7                         epel
python36-asn1crypto.noarch               0.24.0-6.el7                       epel
python36-blosc.x86_64                    1.2.8-4.el7                        epel
python36-bsddb3.x86_64                   6.2.6-3.el7                        epel
python36-chardet.noarch                  2.3.0-4.el7                        epel
uwsgi-plugin-python34-gevent.x86_64      2.0.17.1-1.el7                     epel
uwsgi-plugin-python34-tornado.x86_64     2.0.17.1-1.el7                     epel
uwsgi-plugin-python36.x86_64             2.0.17.1-1.el7                     epel
uwsgi-plugin-python36-gevent.x86_64      2.0.17.1-1.el7                     epel
[root@localhost ~]# yum install python36 -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.njupt.edu.cn
 * epel: mirrors.yun-idc.com
 * extras: mirrors.163.com
 * updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package python36.x86_64 0:3.6.6-2.el7 will be installed
--> Processing Dependency: python36-libs(x86-64) = 3.6.6-2.el7 for package: python36-3.6.6-2.el7.x86_64
--> Processing Dependency: libpython3.6m.so.1.0()(64bit) for package: python36-3.6.6-2.el7.x86_64
--> Running transaction check
---> Package python36-libs.x86_64 0:3.6.6-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package               Arch           Version                Repository    Size
================================================================================
Installing:
 python36              x86_64         3.6.6-2.el7            epel          66 k
Installing for dependencies:
 python36-libs         x86_64         3.6.6-2.el7            epel         8.6 M

Transaction Summary
================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 8.6 M
Installed size: 36 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/epel/packages/python36-3.6.6-2.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Public key for python36-3.6.6-2.el7.x86_64.rpm is not installed
(1/2): python36-3.6.6-2.el7.x86_64.rpm                     |  66 kB   00:01
(2/2): python36-libs-3.6.6-2.el7.x86_64.rpm                | 8.6 MB   00:29
--------------------------------------------------------------------------------
Total                                              297 kB/s | 8.6 MB  00:29
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
 Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"
 Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
 Package    : epel-release-7-11.noarch (@extras)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python36-libs-3.6.6-2.el7.x86_64                             1/2
  Installing : python36-3.6.6-2.el7.x86_64                                  2/2
  Verifying  : python36-3.6.6-2.el7.x86_64                                  1/2
  Verifying  : python36-libs-3.6.6-2.el7.x86_64                             2/2 

Installed:
  python36.x86_64 0:3.6.6-2.el7                                                 

Dependency Installed:
  python36-libs.x86_64 0:3.6.6-2.el7                                            

Complete!

python36 安装成功后,可以使用 rpm 命令查看一python36 具体包含哪些命令和文件

root@localhost ~]# rpm -ql python36
/usr/bin/pydoc3.6
/usr/bin/python3.6
/usr/bin/python3.6m
/usr/bin/python36
/usr/bin/pyvenv-3.6
/usr/share/doc/python36-3.6.6
/usr/share/doc/python36-3.6.6/README.rst
/usr/share/licenses/python36-3.6.6
/usr/share/licenses/python36-3.6.6/LICENSE
/usr/share/man/man1/python3.6.1.gz

CentOS7系统中Pycharm环境使用

[python@localhost ~]$ wget https://download.jetbrains.com/python/pycharm-community-2018.3.5.tar.gz
--2019-03-25 17:27:00--  https://download.jetbrains.com/python/pycharm-community-2018.3.5.tar.gz
Resolving download.jetbrains.com (download.jetbrains.com)... 54.72.98.183, 52.18.241.155, 2a05:d018:93b:d103:524e:e6ed:6592:1823, ...
Connecting to download.jetbrains.com (download.jetbrains.com)|54.72.98.183|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://download.jetbrains.8686c.com/python/pycharm-community-2018.3.5.tar.gz [following]
--2019-03-25 17:27:02--  https://download.jetbrains.8686c.com/python/pycharm-community-2018.3.5.tar.gz
Resolving download.jetbrains.8686c.com (download.jetbrains.8686c.com)... 60.221.21.254, 2408:876c:0:100::25
Connecting to download.jetbrains.8686c.com (download.jetbrains.8686c.com)|60.221.21.254|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 311914955 (297M) [application/octet-stream]
Saving to: ‘pycharm-community-2018.3.5.tar.gz'

100%[=================================================================================================>] 311,914,955 1.22MB/s   in 7m 53s 

2019-03-25 17:34:55 (644 KB/s) - ‘pycharm-community-2018.3.5.tar.gz' saved [311914955/311914955]

[python@localhost ~]$
[python@localhost ~]$ ll
total 304644
drwxr-xr-x. 2 python python      4096 Mar 25 17:02 Desktop
drwxr-xr-x. 2 python python      4096 Mar 25 17:02 Documents
drwxr-xr-x. 2 python python      4096 Mar 25 17:02 Downloads
drwxr-xr-x. 2 python python      4096 Mar 25 17:02 Music
drwxr-xr-x. 2 python python      4096 Mar 25 17:02 Pictures
drwxr-xr-x. 2 python python      4096 Mar 25 17:02 Public
-rw-rw-r--. 1 python python 311914955 Feb 27 19:15 pycharm-community-2018.3.5.tar.gz
drwxr-xr-x. 2 python python      4096 Mar 25 17:02 Templates
drwxr-xr-x. 2 python python      4096 Mar 25 17:02 Videos

上图中,下载软件包过程比较慢,建议提前下载好对应的软件包,方便后续安装操作。安装过程比较简单,直接解压开就可以使用

[python@localhost ~]$ mkdir software
[python@localhost ~]$ tar xf pycharm-community-2018.3.5.tar.gz -C software/
[python@localhost ~]$ cd software
[python@localhost software]$ mv pycharm-community-2018.3.5 pycharm180305
[python@localhost software]$ cd pycharm180305/
[python@localhost pycharm180305]$ cd bin
[python@localhost bin]$ ls
format.sh     fsnotifier-arm   libdbm64.so  pycharm64.vmoptions  pycharm.svg
fsnotifier    idea.properties  log.xml      pycharm.png          pycharm.vmoptions
fsnotifier64  inspect.sh       printenv.py  pycharm.sh           restart.py
[python@localhost bin]$ ./pycharm.sh
Mar 25, 2019 5:45:20 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Mar 25, 2019 5:45:20 PM java.util.prefs.FileSystemPreferences$6 run
WARNING: Prefs file removed in background /home/python/.java/.userPrefs/prefs.xml

这个属于版本问题

利用Pycharm安装Jupyter

通过 CentOS7 系统桌面中创建的 pycharm 快捷方程式打开 pycharm ,然后点击 pycharm中的控制台,进行 pip 的跟新 和 jupyter 的安装

(venv) [python@localhost test]$ pip install --upgrade pip
(venv) [python@localhost test]$ pip install jupyter
(venv) [python@localhost test]$ jupyter notebook --ip=0.0.0.0 --port=8000
[I 18:25:00.814 NotebookApp] Serving notebooks from local directory: /home/python/PycharmProjects/test
[I 18:25:00.815 NotebookApp] The Jupyter Notebook is running at:
[I 18:25:00.815 NotebookApp] http://(localhost.localdomain or 127.0.0.1):8000/?token=f7d20e19f9abf2cd8323034c6a60e6bf0a3c30a98f866fbc
[I 18:25:00.815 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 18:25:00.833 NotebookApp] 

    To access the notebook, open this file in a browser:
        file:///run/user/1001/jupyter/nbserver-8326-open.html
    Or copy and paste one of these URLs:
        http://(localhost.localdomain or 127.0.0.1):8000/?token=f7d20e19f9abf2cd8323034c6a60e6bf0a3c30a98f866fbc
^C[I 18:25:14.249 NotebookApp] interrupted
Serving notebooks from local directory: /home/python/PycharmProjects/test
0 active kernels
The Jupyter Notebook is running at:
http://(localhost.localdomain or 127.0.0.1):8000/?token=f7d20e19f9abf2cd8323034c6a60e6bf0a3c30a98f866fbc
Shutdown this notebook server (y/[n])? y
[C 18:25:16.200 NotebookApp] Shutdown confirmed
[I 18:25:16.210 NotebookApp] Shutting down 0 kernels
(venv) [python@localhost test]$

以上为个人经验,希望能给大家一个参考,也希望大家多多支持我们。

(0)

相关推荐

  • Pycharm安装并配置jupyter notebook的实现

    一: 安装命令jupyter: pip install jupyter 如果缺少依赖,缺啥装啥 二: 运行 jupyter notebook 首先,查看一下自己是否已经安装成功,在终端输入: jupyter notebook 如果运行成功,结果如下: [I 09:03:15.177 NotebookApp] JupyterLab beta preview extension loaded from /home/winddy/anaconda3/lib/python3.6/site-package

  • 基于jupyter代码无法在pycharm中运行的解决方法

    存在问题: jupyter代码无法在pycharm中运行 原因:工作文件和安装文件不统一引起的 解决方案: pycharm中新建工程项目时,要将图中所示红色部分勾选,从而保证可以引用到相应文件 补充知识:jupyter 在浏览器中 代码不执行 在机器学习的时候,当开始就遇到问题,pycharm启动jupyter notebook之后,浏览器前两行代码执行的好好的,后面就不执行了,上面的键全点了一遍(英语不行,见谅- -,死马当活马医).还是不行,后来,返现右上角python3旁边有个圈,当我重新

  • 在PyCharm环境中使用Jupyter Notebook的两种方法总结

    方法一: 1.安装Jupyter Notebook pip install jupyter 2.在PyCharm中新建Jupyter Notebook文件 步骤:File->New...->Jupyter Notebook->输入文件名 建好之后效果如下图所示,就是熟悉的Jupyter Notebook界面: 3.运行 输入代码,点击绿色小三角运行代码. 方法二: 1.安装Jupyter Notebook pip install jupyter 2.打开Python Console 打开

  • 解决pycharm上的jupyter notebook端口被占用问题

    在pycharm中的jupyter notebook上经常会出现端口被占用,ipython的port端口一般是8888 如果打开了jupyter notebook,而没有关闭时,再次打开pycharm上的jupyter notebook就会出现端口被占用, 运行时有下面的问题: the notebook server could not be started because no available port 这时最简单的办法就是打开运行管理器,结束python.exe程序.这样就可以了. 另一

  • pycharm中jupyter的使用图文教程

    步骤 1.安装Jupyter pip install jupyter 2. 新建一个IPython文件 3.在Terminal里启动Jupyter Notebook 4. 编写程序 随便写点什么测试一下,应该得到的结果是这样的: print(1) 点击运行! 填入上面的地址即可 补充:Linux下安装Pycharm和jupyter Linux下python CentOS7下默认 安装python3 默认情况下 CentOS7 系统中自带的 Python 版本是2.7版本.我们当前工作的Pytho

  • PyCharm中配置PySide2的图文教程

    一.准备工作 1. 安装 Pyside2 1.1 使用pip安装Pyside2 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyside2 1.2 查看安装结果 pip freeze 2. 确定Pyside2安装位置 重复安装以获取安装位置,一般为Python安装目录下. pip install Pyside2 二.在 PyCharm中设置自定义工具 在PyCharm中自定义两个工具以便开发时使用. 步骤:File->Setti

  • 配置 Pycharm 默认 Test runner 的图文教程

    如下所示: 由图中可见,当前使用的是 unittest 测试框架 修改方式如下: 以上这篇配置 Pycharm 默认 Test runner 的图文教程就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持我们.

  • Pycharm 设置默认头的图文教程

    1. 设置的路径是File->settings->Editor->File and Code Templates->Python Script内容见图: 这样新建文件的时候就会默认头如下: 这里说明下#!/usr/bin/evn python 和 #!/usr/bin/python的区别: 第一种写法是在PC的Path中找寻第一个python 用来执行你所编写的脚本信息. 第二种写法是把地址写死,这样可能导致找不到可以执行脚本的python就会报错. 以上这篇Pycharm 设置默

  • 在虚拟机virtualbox中安装ubuntu的图文教程

    距离ubuntu最新版发布已经差不多半年了,博主近来对linux系统有了兴趣,奈何资金不足无法购置一台新机来安装ubuntu.所以想到了虚拟机. 虚拟机的选择 VMwareWorkstation,功能强大,虚拟机的显卡也不错.VMware缺点是很不绿色,会对你的系统有一些影响.而vmare workstation本身有点臃肿,占用系统资源比较多. Virtualbox虚拟机相对比VMWare workstation轻量级一些,运行一般的游戏的话,性能不输于vmware.但是配置起来相对麻烦,而且

  • IntelliJ IDEA 中git的使用图文教程

    项目管理离不开版本控制,目前主流版本控制工具大概就是SVN和Git,至于两者有啥区别这里就不详细介绍了,如果有不明白的可以上网查资料,后期如果有机会我再开篇栏目细说,而且现在市场上Git的使用率已经远远高于SVN.我们在用IDEA开发项目的时候如何熟练使用Git来控制代码版本呢? 一.安装Git 使用Git当然需要先安装Git,安装过程就不详细说明了,按装好之后,打开IDEA进入设置界面(可以直接点击工具栏上的,也可以通过快捷键Ctrl + Alt + S),搜索git,界面如下: 我们可以看到

  • mac下pycharm设置python版本的图文教程

    安装了pycharm 5.0.1,创建了测试项目,发现python的版本是2.6.9的,系统自带的版本好像是2.7的,为什么这样,怎么切换到2.7 看了一下系统到底装了些什么版本 居然有两个版本 接下来设置解释器的路径 Pycharm>Preferences>Build,Excution,Deployment>Console>Python Console 设置External Libraries Pycharm>Project:项目名>Project Interpret

  • Mac PyCharm中的.gitignore 安装设置教程

    gitignore是什么文件 就是git软件要忽略的文件列表,如果要忽略某些文件,,在Git工作区的根目录下创建一个特殊的.gitignore文件,然后把要忽略的文件名填进去,Git就会自动忽略这些文件. 1. 首先安装.ignore 点击 PyCharm >>> Preferences 点击Plugins >>> 在搜索框输入.ignore >>> 然后安装就OK了. 我这里已经安装了 显示的是卸载 没有安装会显示Install . 安装完成以后 点

  • pycharm中leetcode插件使用图文详解

    1.安装插件步骤 2.点击OK确认之后,提示IDE需要重启,选择重启: 3.设置leetcode插件,用户名.密码: 4.点击右下角的leetcode: 题库就出来了,双击进入开发编辑界面: 做完题之后,可选择运行.测试.提交,查看执行情况: 到此这篇关于pycharm中leetcode插件使用图文详解的文章就介绍到这了,更多相关pycharm中leetcode插件内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!

  • Eclipse中配置Maven的图文教程

    一. 安装Maven 下载地址:http://maven.apache.org/检查 JAVA_HOME 环境变量. Maven 是使用 Java 开发的,所以必须知道当前系统环境中 JDK 的安装目录. 解压 Maven 的核心程序 将 apache-maven-3.6.3-bin.zip 解压到一个非中文无空格的目录下配置环境变量. 查看 Maven 版本信息验证安装是否正确 二.设置Maven的配置文件 1. 配置本地仓库 Maven 的核心程序并不包含具体功能,仅负责宏观调度.具体功能由

随机推荐