使用anaconda如何安装opencv、os、PIL、skimage等

1.安装opencv: python -m pip install opencv-python

调用时为import cv2


2.要from PIL import Image

安装:conda install pillow


3.标准库:https://www.jb51.net/article/57834.htm

出现错误:
ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问。: ‘d:\sf\anaconda3\envs\pytorch\lib\site-packages\~5py\defs.cp36-win_amd64.pyd’
Consider using the --user option or check the permissions.
在这里插入图片描述
则在package名称前面加上–user,增加管理员权限
如pip install tensorflow→pip install --user tensorflow

4.一些库对应python版本的安装版本:pypi

5.出现错误:安装h5pyViewer==0.0.1.6时

ERROR: Command errored out with exit status 1:
 command: 'D:\sf\Anaconda3\envs\tensorflow\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\26603\\AppData\\Local\\Temp\\pip-install-z809vh8z\\h5pyviewer\\setup.py'"'"'; __file__='"'"'C:\\Users\\26603\\AppData\\Local\\Temp\\pip-install-z809vh8z\\h5pyviewer\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\26603\AppData\Local\Temp\pip-pip-egg-info-306uckpc'
     cwd: C:\Users\26603\AppData\Local\Temp\pip-install-z809vh8z\h5pyviewer\
Complete output (6 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\26603\AppData\Local\Temp\pip-install-z809vh8z\h5pyviewer\setup.py", line 82
    print ':'+ver+':'+gitcmt+':'
          ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(':'+ver+':'+gitcmt+':')?
----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
在这里插入图片描述
解决:python2版本的print是没有括号的,例如print x即可,且整数型数字前不能加0,例如x=0256不可以,要把0删掉。
而python3是python(x)


6.安装pycocotools==2.0时

ERROR: Command errored out with exit status 1:
 command: 'D:\sf\Anaconda3\envs\imageflow_python27\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\26603\\appdata\\local\\temp\\pip-install-bu2nsq\\pycocotools\\setup.py'"'"'; __file__='"'"'c:\\users\\26603\\appdata\\local\\temp\\pip-install-bu2nsq\\pycocotools\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'c:\users\26603\appdata\local\temp\pip-install-bu2nsq\pycocotools\pip-egg-info'
     cwd: c:\users\26603\appdata\local\temp\pip-install-bu2nsq\pycocotools\
Complete output (5 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\users\26603\appdata\local\temp\pip-install-bu2nsq\pycocotools\setup.py", line 2, in <module>
    from Cython.Build import cythonize
ImportError: No module named Cython.Build
----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
在这里插入图片描述
解决:原本以为Cython_Build也需要pip install,但其并不是一个库,看样子应该是Cython内的一个子类别。使用pip show看一下自己的Cython有没有pip,pip成功了即可。——在这里我遇到了我pip install Cython显示succesfully,但是pip show Cython却说没有安装这个库,我重复了几次pip install就成功pip show了。
在这里插入图片描述


8.安装skimage

https://blog.csdn.net/weixin_36670529/article/details/111245842

安装到这里,突然发现windows的python2.7不支持tensorflow…


查看anaconda里自己的虚拟环境的python版本

python --version

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值