python开发conda虚拟环境中,常用No module named 问题的导包命令

在配置python开发环境时,运行pycharm经常会缺失一些必要的模块,下面整理记录本人在实验时碰到的一些缺失问题和解决办法。

环境:windows+cuda 10.0+python3.6.7+pytorch1.2.0

打开 Anaconda Prompt 进入自己的虚拟环境:

例如我的就是 activte LY-pytorch

缺模块问题总结:

① ImportError:No module named skimage

 pip install scikit-image

②pytorch报错:ValueError: num_samples should be a positive integer value, but got num_samples=0

 解决:可能是没有放dataset数据集

③No module named 'cv2'

pip install opencv-python

④报错:ERROR: Could not find a version that satisfies the requirement pyyaml
ERROR: No matching distribution found for pyyaml
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:847)'),)) - skipping

解决办法:

一、关掉代理(科学上网)

二、开着代理时:

pip install 插件名 -i 国内镜像地址 http://pypi.douban.com/simple --trusted-host pypi.douban.com,

举例:

pip install  pyyaml -i  http://pypi.douban.com/simple --trusted-host pypi.douban.com

1)http://mirrors.aliyun.com/pypi/simple/ 阿里云

2)https://pypi.mirrors.ustc.edu.cn/simple/  中国科技大学

3) http://pypi.douban.com/simple/  豆瓣

4) https://pypi.tuna.tsinghua.edu.cn/simple/ 清华大学

5)  http://pypi.mirrors.ustc.edu.cn/simple/ 中国科学技术大学

⑤使用pillow打开TIFF文件报tempfile.tif: Cannot read TIFF header错误的解决方案

使用pillow的 Image.open(tiff file path)报错tempfile.tif: Cannot read TIFF header.的错误。

原因是 libtiff的版本问题。 将版本降到4.0.10即可解决。(conda install libtiff=4.0.10 or pip install libtiff=4.0.10)
 


版权声明:本文为yuxing_miao原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。