【Python】window环境使用venv部署jupyter notebook

基础信息

执行win+r,在输入框输入powershell:
【Python】window环境使用venv部署jupyter notebook_第1张图片
python版本:python -v

创建并激活虚拟环境

1、进入要创建虚拟环境的目录,操作示例如下:
PS C:\Users\Administrator> cd D:\Python\weltest
2、创建虚拟环境,操作示例如下:
PS D:\Python\weltest> python -m venv mlven
3、激活虚拟环境,首次会出现如下错误’UnauthorizedAccess’,操作示例如下:

PS D:\Python\weltest> .\mlven\Scripts\activate
.\mlven\Scripts\activate : 无法加载文件 D:\Python\weltest\mlven\Scripts\Activate.ps1,因为在此系统上禁止运行脚本。有关
详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ .\mlven\Scripts\activate
+ ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS D:\Python\weltest> Set-ExecutionPolicy RemoteSigned
PS D:\Python\weltest> .\mlven\Scripts\activate

4、再次执行激活命令,操作示例:
PS D:\Python\weltest> .\mlven\Scripts\activate

在虚拟环境安装jupyter notebook

激活虚拟环境之后,执行如下命令,安装:
(mlven) PS D:\Python\weltest> pip install jupyter notebook
安装成功,截图如下:
【Python】window环境使用venv部署jupyter notebook_第2张图片

启动并验证jupyter notebook

激活虚拟环境执行如下命令:
(mlven) PS D:\Python\weltest> jupyter notebook
【Python】window环境使用venv部署jupyter notebook_第3张图片
应用界面:
【Python】window环境使用venv部署jupyter notebook_第4张图片
新建一个notebook,输入hello world验证部署成功
在这里插入图片描述

你可能感兴趣的:(人工智能,WEL测试,#,python脚本小册,python,jupyter,开发语言)