打开Anaconda Navigator提示错误

发布于 2022-09-11 20:09:42 字数 4555 浏览 12 评论 0

打开Anaconda Navigator提示错误 怎么改?
expected str, bytes or os.PathLike object, not NoneType

Traceback (most recent call last):
  File "D:\software\anaconda\lib\site-packages\anaconda_navigator\exceptions.py", line 75, in exception_handler
    return_value = func(*args, **kwargs)
  File "D:\software\anaconda\lib\site-packages\anaconda_navigator\app\start.py", line 150, in start_app
    window = run_app(splash)
  File "D:\software\anaconda\lib\site-packages\anaconda_navigator\app\start.py", line 65, in run_app
    window = MainWindow(splash=splash, tab_project=False)
  File "D:\software\anaconda\lib\site-packages\anaconda_navigator\widgets\main_window.py", line 163, in __init__
    self.api = AnacondaAPI()
  File "D:\software\anaconda\lib\site-packages\anaconda_navigator\api\anaconda_api.py", line 2185, in AnacondaAPI
    ANACONDA_API = _AnacondaAPI()
  File "D:\software\anaconda\lib\site-packages\anaconda_navigator\api\anaconda_api.py", line 89, in __init__
    self._conda_api = CondaAPI()
  File "D:\software\anaconda\lib\site-packages\anaconda_navigator\api\conda_api.py", line 1714, in CondaAPI
    CONDA_API = _CondaAPI()
  File "D:\software\anaconda\lib\site-packages\anaconda_navigator\api\conda_api.py", line 353, in __init__
    self.sys_rc_path = join(self.ROOT_PREFIX, '.condarc')
  File "D:\software\anaconda\lib\ntpath.py", line 76, in join
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType

页面完整代码?

# -*- coding: utf-8 -*-
"""Navigator Exceptions and Exception handling module."""

# Standard library imports
from traceback import format_exc


def display_qt_error_box(error, traceback):
    """Display a Qt styled error message box."""
    from anaconda_navigator.widgets.dialogs import MessageBoxError
    text = (
        'An unexpected error occurred on Navigator start-up<br>'
        '{error}'.format(error=error)
    )
    trace = '{trace}'.format(trace=traceback)
    print(text)
    print(trace)
    msg_box = MessageBoxError(
        title='Navigator Start Error',
        text=text,
        error=trace,
        report=False,  # Disable reporting on github
        learn_more=None,
    )
    msg_box.setFixedWidth(600)
    return msg_box.exec_()


def display_browser_error_box(error, traceback):
    """Display a new browser window with an error description."""
    template = '''
    <html>
    <head>
      <title>Navigator Error</title>
    </head>
    <body>
      <div>
        <h1>Navigator Error</h1>
        <p>An unexpected error occurred on Navigator start-up</p>
        <h2>Report</h2>
        <p>Please report this issue in the anaconda
          <a href="https://github.com/continuumio/anaconda-issues">
            issue tracker
          </a>
        </p>
      </div>
      <div>
        <h2>Main Error</h2>
        <p><pre>{error}</pre></p>
        <h2>Traceback</h2>
        <p><pre>{trace}</pre></p>
      </div>
    </body>
    </html>
    '''
    try:
        from urllib import pathname2url  # Python 2.x
    except Exception:
        from urllib.request import pathname2url  # Python 3.x

    import tempfile
    temppath = tempfile.mktemp(suffix='.html')
    with open(temppath, 'w') as f:
        f.write(template.format(error=error, trace=traceback))

    url = 'file:{}'.format(pathname2url(temppath))

    import webbrowser
    webbrowser.open_new_tab(url)


def exception_handler(func, *args, **kwargs):
    """Handle global application exceptions and display information."""
    try:
        return_value = func(*args, **kwargs)
        if isinstance(return_value, int):
            return return_value
    except Exception as e:
        return handle_exception(e)


def try_func(func, *args, **kwargs):
    try:
        value = func(*args, **kwargs)
        return value
    except Exception as e:
        return handle_exception(e)


def handle_exception(error):
    """This will provide a dialog for the user with the error found."""
    traceback = format_exc()

    # Try using a Qt message box, if that fails
    try:
        display_qt_error_box(error, traceback)
    except Exception:
        # If that fails try to write a temp html file
        try:
            display_browser_error_box(error, traceback)
        except Exception:
            print(traceback)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小糖芽 2022-09-18 20:09:42

删除C:\Users\username\.condarc
参考链接

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文