python virtual enviroment
1
2
3
4
5
6
7
8
9
10
# 创建虚拟环境
python -m venv .venv
# 切换到虚拟环境
source .venv/bin/active
# 添加环境中的python Kernel到juypter,当然下面的projectname 还是改一个合适的名称哦
ipython kernel install --user --name=projectname
# 切到项目工作空间
cd workspace
# 运行jupyter
jupyter notebook

最终就能在下图位置中,找到虚拟的环境了。如果要需要安装第三方包,jupyter也可以直接开启termial安装。用来做调试小爬虫很轻巧呢。

image-20200506110943033

Author: Chandler Kwok
Link: http://yoursite.com/2020/05/05/python-virtual-enviroment/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.