Pycharm各类问题解决方案

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/BreakingDawn0/article/details/102674552

一边学习一边更新

1.Pycharm下载各种包超时(Read time out)

根本原因是pip install xxx默认访问外网https://files.pythonhosted.org/packages下载,速度贼慢。

试了各种方法,吐血经历,将下载地址换到国内镜像才是最好的解决方案。

pip install xxx -i https://mirrors.aliyun.com/pypi/simple/

国内镜像可以用下面任一个:

阿里云 https://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 https://pypi.mirrors.ustc.edu.cn/simple/

一劳永逸的方法是:(windows下)

  • 在C:\Users\xxx\目录下创建一个pip目录
  • 进入pip文件夹(C:\Users\xxx\pip),新建.txt文档重命名为pip.ini
  • 打开pip.ini(使用Notepad++或者其它),粘贴以下内容,镜像网址可以选择上述任一
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=pypi.doubanio.com
  •  在环境便量中(我的电脑>右键属性>高级系统设置>环境变量>系统变量>Path中)添加 %HOME%\pip\pip.ini

2.Tensorflow运行时警告FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.np_resource = np.dtype([("resource", np.ubyte, 1)])

numpy版本高的原因,重装numpy 1.16就可以

在Pycharm中file>setting>Project xxx>Project Interpreter双击列表里的numpy勾选Specify version选择版本

3.Tensorboard浏览器查看日志时打不开http://127.0.0.1:6006

  • 编写有生成日志的代码(写过才会有这个问题吧)
  • 启动tensorboard:win+R打开cmd,cd [你的日志目录] (这里是日志文件所在的目录,与一般教程里说的日志上一级目录不同)
  • 接着输入命令:
    tensorboard --logdir ./ --host=127.0.0.1
  • 浏览器中打开http://127.0.0.1:6006即可

成功后

猜你喜欢

转载自blog.csdn.net/BreakingDawn0/article/details/102674552