前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >opencv-安装opencv&jupyterlab

opencv-安装opencv&jupyterlab

原创
作者头像
小毛coder
发布2024-03-26 15:22:53
2780
发布2024-03-26 15:22:53
举报
文章被收录于专栏:opencv
前提
  • 基础环境
  • windows10 python 3.10.11 virtualenv 20.25.1
  • 项目目录E:\project\opencv,注意替换成实际安装目录
创建虚拟环境
  • 创建项目目录 E:\project\opencv
  • 创建虚拟环境virtualenv .env
代码语言:bash
复制
E:\project\opencv>virtualenv .env
created virtual environment CPython3.10.11.final.0-64 in 3873ms
  creator CPython3Windows(dest=E:\project\opencv\.env, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\bom\AppData\Local\pypa\virtualenv)
    added seed packages: pip==24.0, setuptools==69.1.1, wheel==0.42.0
  activators BashActivator,BatchActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
  • 激活虚拟环境,.\.env\Scripts\activate
代码语言:bash
复制
E:\project\opencv>.\.env\Scripts\activate

(.env) E:\project\opencv>
虚拟环境安装pip-autoremove

主要是用来移除依赖包,可以清除依赖的依赖

  • 一定要在虚拟环境中安装pip-autoremove
代码语言:bash
复制
(.env) E:\project\opencv>pip install pip-autoremove==0.10.0
Looking in indexes: https://mirrors.aliyun.com/pypi/simple, https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pip-autoremove==0.10.0
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/81/33/07306f6de85b42ae5a8db4b0bf6abd447c699d3902998a7f873e6bce6c2c/pip_autoremove-0.10.0-py2.py3-none-any.whl (5.0 kB)
Requirement already satisfied: pip in e:\project\opencv\.env\lib\site-packages (from pip-autoremove==0.10.0) (24.0)
Requirement already satisfied: setuptools in e:\project\opencv\.env\lib\site-packages (from pip-autoremove==0.10.0) (69.1.1)
Installing collected packages: pip-autoremove
Successfully installed pip-autoremove-0.10.0
虚拟环境安装opencv
代码语言:bash
复制
(.env) E:\project\opencv>pip install opencv-python==4.9.0.80
Looking in indexes: https://mirrors.aliyun.com/pypi/simple, https://pypi.tuna.tsinghua.edu.cn/simple
Collecting opencv-python==4.9.0.80
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/c7/ec/9dabb6a9abfdebb3c45b0cc52dec901caafef2b2c7e7d6a839ed86d81e91/opencv_python-4.9.0.80-cp37-abi3-win_amd64.whl (38.6 MB)
Collecting numpy>=1.21.2 (from opencv-python==4.9.0.80)
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/19/77/538f202862b9183f54108557bfda67e17603fc560c384559e769321c9d92/numpy-1.26.4-cp310-cp310-win_amd64.whl (15.8 MB)
     ---------------------------------------- 15.8/15.8 MB 1.1 MB/s eta 0:00:00
Installing collected packages: numpy, opencv-python
Successfully installed numpy-1.26.4 opencv-python-4.9.0.80
虚拟环境安装jupyterlab

耗时较长,JupyterLab 是一个集 Jupyter Notebook 、文本编辑器、终端以及各种个性化组件于一体的全能IDE

代码语言:bash
复制
(.env) E:\project\opencv>pip install jupyterlab==4.1.5
Looking in indexes: https://mirrors.aliyun.com/pypi/simple, https://pypi.tuna.tsinghua.edu.cn/simple
Collecting jupyterlab==4.1.5
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/b4/bb/1f9f7ddf04cfe26b21aab739ec905bbafa401642614ac9c9d26cf13cb7a3/jupyterlab-4.1.5-py3-none-any.whl (11.4 MB)
  ......
ents>=0.9.0->jupyter-server<3,>=2.4.0->jupyterlab==4.1.5)
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c7/1b/af4f4c4f3f7339a4b7eb3c0ab13416db98f8ac09de3399129ee5fdfa282b/types_python_dateutil-2.9.0.20240316-py3-none-any.whl (9.7 kB)
Installing collected packages: webencodings, wcwidth, pywin32, pure-eval, fastjsonschema, websocket-client, webcolors, urllib3, uri-template, typing-extensions, types-python-dateutil, traitlets, tornado, tomli, tinycss2, soupsieve, sniffio, six, send2trash, rpds-py, rfc3986-validator, pyzmq, pyyaml, pywinpty, python-json-logger, pygments, pycparser, psutil, prompt-toolkit, prometheus-client, platformdirs, parso, pandocfilters, packaging, overrides, nest-asyncio, mistune, MarkupSafe, jupyterlab-pygments, jsonpointer, json5, idna, h11, fqdn, executing, exceptiongroup, defusedxml, decorator, debugpy, colorama, charset-normalizer, certifi, babel, attrs, terminado, rfc3339-validator, requests, referencing, python-dateutil, matplotlib-inline, jupyter-core, jinja2, jedi, httpcore, comm, cffi, bleach, beautifulsoup4, async-lru, asttokens, anyio, stack-data, jupyter-server-terminals, jupyter-client, jsonschema-specifications, httpx, arrow, argon2-cffi-bindings, jsonschema, isoduration, ipython, argon2-cffi, nbformat, ipykernel, nbclient, jupyter-events, nbconvert, jupyter-server, notebook-shim, jupyterlab-server, jupyter-lsp, jupyterlab
启用jupyterlab
代码语言:bash
复制
(.env) E:\project\opencv>jupyter lab
[I 2024-03-26 15:19:12.759 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2024-03-26 15:19:12.769 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2024-03-26 15:19:12.791 ServerApp] jupyterlab | extension was successfully linked.
[I 2024-03-26 15:19:13.197 ServerApp] notebook_shim | extension was successfully linked.
[I 2024-03-26 15:19:13.237 ServerApp] notebook_shim | extension was successfully loaded.
[I 2024-03-26 15:19:13.240 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2024-03-26 15:19:13.241 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2024-03-26 15:19:13.244 LabApp] JupyterLab extension loaded from E:\project\opencv\.env\lib\site-packages\jupyterlab
[I 2024-03-26 15:19:13.244 LabApp] JupyterLab application directory is E:\project\opencv\.env\share\jupyter\lab
[I 2024-03-26 15:19:13.246 LabApp] Extension Manager is 'pypi'.
[I 2024-03-26 15:19:13.261 ServerApp] jupyterlab | extension was successfully loaded.
[I 2024-03-26 15:19:13.262 ServerApp] The port 8888 is already in use, trying another port.
[I 2024-03-26 15:19:13.264 ServerApp] Serving notebooks from local directory: E:\project\opencv
[I 2024-03-26 15:19:13.264 ServerApp] Jupyter Server 2.13.0 is running at:
[I 2024-03-26 15:19:13.265 ServerApp] http://localhost:8889/lab?token=684340a672006b131dc64f6cf2a781d1434833cb7c57afd2
[I 2024-03-26 15:19:13.265 ServerApp]     http://127.0.0.1:8889/lab?token=684340a672006b131dc64f6cf2a781d1434833cb7c57afd2
[I 2024-03-26 15:19:13.266 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 前提
  • 创建虚拟环境
  • 虚拟环境安装pip-autoremove
  • 虚拟环境安装opencv
  • 虚拟环境安装jupyterlab
  • 启用jupyterlab
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档