Windows下配置Python(numpy,opencv)的踩雷历史

编程入门 行业动态 更新时间:2024-10-08 02:20:08

Windows下配置Python(numpy,opencv)的踩雷<a href=https://www.elefans.com/category/jswz/34/1770089.html style=历史"/>

Windows下配置Python(numpy,opencv)的踩雷历史

原来我还写过这个,贴一下。

C:\Windows\system32>pip list
Traceback (most recent call last):File "d:\python\python\lib\runpy.py", line 170, in _run_module_as_main"__main__", mod_spec)File "d:\python\python\lib\runpy.py", line 85, in _run_codeexec(code, run_globals)File "D:\Python\python\Scripts\pip.exe\__main__.py", line 5, in <module>File "d:\python\python\lib\site-packages\pip\_internal\cli\main.py", line 60sys.stderr.write(f"ERROR: {exc}")^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:Traceback (most recent call last):File "<string>", line 20, in <module>File "C:\Users\WWW\AppData\Local\Temp\pip-build-qplium6r\opencv-python\set
up.py", line 10, in <module>import skbuildImportError: No module named 'skbuild'----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\WWW\AppD
ata\Local\Temp\pip-build-qplium6r\opencv-python
You are using pip version 7.1.2, however version 21.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

卸载重装了python,又出现了要升级的问题。

一旦升级,又出现invalid syntax问题。

卸载,忽视升级问题,重新安装。

C:\Users\WWW>pip install opencv-python
Collecting opencv-pythonUsing cached 
bf749ddb531bd26256edfff5b6c2195eca26258e9/opencv-python-4.5.1.48.tar.gzComplete output from command python setup.py egg_info:Traceback (most recent call last):File "<string>", line 20, in <module>File "C:\Users\WWW\AppData\Local\Temp\pip-build-kp2fw54u\opencv-python\set
up.py", line 10, in <module>import skbuildImportError: No module named 'skbuild'----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\WWW\AppData\Local\Temp\pip-build-kp2fw54u\opencv-python

按照提示安装了skbuild模块,再次尝试安装opencv

C:\Users\WWW>pip install opencv-python -i  opencv-pythonThe repository located at mirrors.aliyun is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host mirrors.aliyun'.
Could not find a version that satisfies the requirement opencv-python (from versions: )
No matching distribution found for opencv-python
You are using pip version 7.1.2, however version 21.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Could not find a version that satisfies the requirement opencv-python (from versions: )

No matching distribution found for opencv-python

出现上述error

‘–trusted-host mirrors.aliyun’

出现上述warning

修改换源地址后,重新安装opencv

Command "python setup.py egg_info" failed with error code 1 in C:\Users\WWW\AppData\Local\Temp\pip-build-z24v6xtb\numpy
You are using pip version 7.1.2, however version 21.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
C:\Users\WWW>pip install --upgrade setuptools -i  pypi.douban
Requirement already up-to-date: setuptools in c:\users\www\appdata\local\program
s\python\python35\lib\site-packages
You are using pip version 7.1.2, however version 21.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

更新了setuptools

尝试重新安装numpy,失败,仍然错误

    Complete output from command python setup.py egg_info:Traceback (most recent call last):File "<string>", line 20, in <module>File "C:\Users\WWW\AppData\Local\Temp\pip-build-27jupq9q\numpy\setup.py",
line 30, in <module>raise RuntimeError("Python version >= 3.7 required.")----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\WWW\AppData\Local\Temp\pip-build-27jupq9q\numpy

注意到这里有个RuntimError,要求python版本。

尝试使用conda?

[3880:3D74][2021-02-04T16:14:02]i000: Did not find D:\Python\unattend.xml
[3880:3D74][2021-02-04T16:14:02]i000: Setting string variable 'ActionLikeInstalling' to value 'Installing'
[3880:3D74][2021-02-04T16:14:02]i000: Setting string variable 'ActionLikeInstallation' to value 'Setup'
[3880:3D74][2021-02-04T16:14:02]i000: Setting version variable 'WixBundleFileVersion' to value '3.7.8150.0'
[3880:3D74][2021-02-04T16:14:02]e000: Detected Windows 7 SP1 without KB2533623
[3880:3D74][2021-02-04T16:14:02]e000: KB2533623 update is required to continue.

安装3.7以上的版本提示错误,注意到KB2533623

解决:

后来用了默认安装,卸载了旧版本记得把C盘的Python文件夹全部删除。

pip3 install -i  scikit-build
pip install SomePackage -i 

Successfully installed numpy-1.20.0 opencv-python-4.5.1.48>

安装成功。

更多推荐

Windows下配置Python(numpy,opencv)的踩雷历史

本文发布于:2024-02-07 05:33:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1753246.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:历史   Python   Windows   opencv   numpy

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!