1 问题描述
在jupyter notebook中导包时出现:
2 解决思路
首先,我的jupyter notebook
是运行在base(root)
环境下的,而在此环境下我并未安装tensorflow
,因此要建立新的虚拟环境,并在该环境下安装tensorflow
。
3 解决过程
step1 conda create -n jup_env tensorflow
问题1
UnavailableInvalidChannel: HTTP 404 NOT FOUND for channel anaconda/pkgs/msps2 <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msps2>
The channel is not accessible or is invalid. You will need to adjust your conda configuration to proceed.
解决办法
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msps2
其实没有搞懂为什么要这样处理…
step2 conda activate jup_env
step3 conda install jupyter notebook
创建了有关jupyter notebook
的新的虚拟环境,因此要重新安装。
问题2
Traceback (most recent call last):
File "D:\PostGraduate\anaconda\envs\jup_env\Scripts\jupyter-notebook-script.py", line 3, in <module>
import notebook.notebookapp
File "D:\PostGraduate\anaconda\envs\jup_env\lib\site-packages\notebook\notebookapp.py", line 40, in <module>
ioloop.install()
File "D:\PostGraduate\anaconda\envs\jup_env\lib\site-packages\zmq\eventloop\ioloop.py", line 210, in install
assert (not ioloop.IOLoop.initialized()) or \
AttributeError: type object 'IOLoop' has no attribute 'initialized'
解决
1.pip list 查看自己的tornado版本;
2.pip unistall tornado;
3.pip list 再次确认是否卸载成功
4.强烈建议安装 pip install tornado==4.4.3 (4.5版本会报一个错:jupyterRuntimeError: No supported color terminal library)
5.关闭终端,再重新进入并输入jupyter notebook (如果安装4.4.3出现setuptools没有先下载这个就ok)
参考:
Anaconda创建新环境时出现HTTP 404 NOT FOUND for url提示(Win10)
彻底解决:AttributeError:type object IOLoop has no attribute initialized