【NLP】怕遗忘了,一些具体操作的记录

5 篇文章 0 订阅
2 篇文章 0 订阅

mac终端下打开Jupyter

python3 -m IPython notebook

homebrew管理python

$ cd /usr/local/opt
$ ls -al python*

python数字图像处的报错问题处理:

ImportError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.

因为 mac 对于 python 的绘图的 tk 不支持,导致我做得比较慢,经过长时间查阅资料后还是无法解决 tk 在 mac 上使用 vscode 来进行绘图,所以后来使用 qt 来进行绘图,成功的解决了绘图问题。
import matplotlib.pyplot as plt之前

import matplotlib
matplotlib.use('Qt5Agg')

查看当前tensorflow版本

pip show tensorflow

更换tensorflow版本

pip install tensorflow==版本号

python对于map的支持,在python2与python3下是不同的
比如说lambda



bert 报错:

bert-serving-start: error: unrecognized arguments: /Users/Iro/code/chinese_L-12_H-768_A-12

解决方法:不知道是版本还是其他什么问题,现在变成
bert-serving-start -model_dir 地址 -num_work 线程数

之前等号能用的啊,现在不能用了



pip install -t . -r requirements.txt
vscode环境下安装依赖变量



查看gpu是否可用

import tensorflow as tf
tf.test.is_gpu_available()

运行python代码,报如下错误:

UnicodeDecodeError:ascii codec can't decode byte 0xe8 in position 0:ordinal not in range(128)

解决办法:在出现问题的页加上如下三行即可:

import sys
reload(sys)
sys.setdefaultencoding('utf-8')

上述为在python2.7版本下的解决方法,python3以上已经将setdefaultencoding给删除了,因为直接用的unicode编码

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值