jupyter安装出现问题:安装后无法打开

jupyter安装出现问题:安装后无法打开

traitlets.traitlets.TraitError: Could not decode 'C:\Users\\xce\xa2\xcc\xf0\xd0\xc4\xd3\xef\.jupyter' for unicode trait 'config_dir' of a NotebookApp instance.

解决办法:将下面一段代码保存为py文件,文件名为“python jupyter_nootbook_start.py”,以后运行该文件即可打开jupyter。

import os
import subprocess
​
#base = 'D:\\Anaconda'
base = 'D:\ProgrammingTool\python\Ana\Anaconda'
jupyter_dir = os.path.join(base,'.jupyter')
if not os.path.exists(jupyter_dir):
    os.mkdir(jupyter_dir)
​
dirs = {'JUPYTER_CONFIG_DIR' : jupyter_dir, 'JUPYTER_RUNTIME_DIR' : os.path.join(jupyter_dir,'runtime'),'JUPYTER_DATA_DIR' : os.path.join(jupyter_dir,'data')}
​
for k,v in dirs.iteritems():   
    if not os.path.exists(v):
        os.mkdir(v)
    os.environ[k] = v
​
ipython_dir = os.path.join(base,'.ipython')
​
os.environ['IPYTHONDIR'] = ipython_dir
​
subprocess.call(['D:\ProgrammingTool\python\Ana\Anaconda\Scripts\jupyter-notebook.exe'])
​

 

 

转载于:https://www.cnblogs.com/ST-2017/p/10428719.html

你可能感兴趣的