尝试一:
python2.7环境安装jupyter notebook ,官方给的代码安装报错Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-install-pjB8H9/ipython/
尝试二:
pip install jupyter notebook, 安装成功,但启动jupyter notebook时报错UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe5 in position 4: ordinal not in range(128)
多方搜罗信息,以上安装报错是因为新版的ipython只支持python3.4以上版本,python2.7的jupyter需配置如下版本。
#=====新建python2.7环境
conda create -n my_name python=2.7 # 创建conda环境
source activate my_name # 激活conda环境
#=====python2.7环境安装jupyter notebook
which jupyter # 默认jupyter路径,通常是主conda环境下的
# 新版的ipython只支持python3.4以上版本,python2.7的jupyter需配置如下版本
pip install ipython==5.5.0
pip install ipykernel==4.8.2
which jupyter # my_name环境下的jupyter
#=====保证my_name环境下的package在python可以引用到
import sys
sys.path # 如果没有my_name下site-packages路径,则手动加入
sys.path.append('/root/anaconda3/envs/my_name/lib/python2.7/site-packages')
#=====启动jupyter
nohup jupyter notebook --no-browser --port=3434 --ip=192.168.1.230 --allow-root --notebook-dir='/'