You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Jupyter Notebook中使用conda安装包时出现八进制转义错误

问题:Jupyter Notebook中执行conda install numpy触发八进制转义错误

在浏览器端使用Jupyter Notebook执行conda install numpy命令时,出现如下错误:

error: octal escape value \760 outside of range 0-0o377 at position 28

完整报错栈信息:

---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
Cell In[3], line 1
----> 1 get_ipython().run_line_magic('conda', 'install numpy')

File D:\76043\anaconda3\Lib\site-packages\IPython\core\interactiveshell.py:2480, in InteractiveShell.run_line_magic(self, magic_name, line, _stack_depth)
   2478     kwargs['local_ns'] = self.get_local_scope(stack_depth)
   2479 with self.builtin_trap:
-> 2480     result = fn(*args, **kwargs)
   2482 # The code below prevents the output from being displayed
   2483 # when using magics with decorator @output_can_be_silenced
   2484 # when the last Python token in the expression is a ';'.
   2485 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):

File D:\76043\anaconda3\Lib\site-packages\IPython\core\magics\packaging.py:30, in is_conda_environment.<locals>.wrapper(*args, **kwargs)
     25 if not Path(sys.prefix, "conda-meta", "history").exists():
     26     raise ValueError(
     27         "The python kernel does not appear to be a conda environment.  "
     28         "Please use ``%pip install`` instead."
     29     )
---> 30 return func(*args, **kwargs)

File D:\76043\anaconda3\Lib\site-packages\IPython\core\magics\packaging.py:128, in PackagingMagics.conda(self, line)
    120 @line_magic
    121 @is_conda_environment
    122 def conda(self, line):
    123     """Run the conda package manager within the current kernel.
    124 
    125     Usage:
    126       %conda install [pkgs]
    127     """
--> 128     conda = _get_conda_like_executable("conda")
    129     self._run_command(conda, line)

File D:\76043\anaconda3\Lib\site-packages\IPython\core\magics\packaging.py:53, in _get_conda_like_executable(command)
     50 # Otherwise, attempt to extract the executable from conda history.
     51 # This applies in any conda environment.
     52 history = Path(sys.prefix, "conda-meta", "history").read_text(encoding="utf-8")
---> 53 match = re.search(
     54     rf"^#\s*cmd:\s*(?P<command>.*{executable})\s[create|install]",
     55     history,
     56     flags=re.MULTILINE,
     57 )
     58 if match:
     59     return match.groupdict()["command"]

File D:\76043\anaconda3\Lib\re\__init__.py:176, in search(pattern, string, flags)
    173 def search(pattern, string, flags=0):
    174     """Scan through string looking for a match to the pattern, returning
    175     a Match object, or None if no match was found."""
--> 176     return _compile(pattern, flags).search(string)

File D:\76043\anaconda3\Lib\re\__init__.py:294, in _compile(pattern, flags)
    288     import warnings
    289     warnings.warn("The re.TEMPLATE/re.T flag is deprecated "
    290               "as it is an undocumented flag "
    291               "without an obvious purpose. "
    292               "Don't use it.",
    293               DeprecationWarning)
---> 294 p = _compiler.compile(pattern, flags)
    295 if not (flags & DEBUG):
    296     if len(_cache) >= _MAXCACHE:
    297         # Drop the oldest item

File D:\76043\anaconda3\Lib\re\_compiler.py:745, in compile(p, flags)
    743 if isstring(p):
    744     pattern = p
--> 745     p = _parser.parse(p, flags)
    746 else:
    747     pattern = None

File D:\76043\anaconda3\Lib\re\_parser.py:989, in parse(str, flags, state)
    986 state.flags = flags
    987 state.str = str
--> 989 p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
    990 p.state.flags = fix_flags(str, p.state.flags)
    992 if source.next is not None:

File D:\76043\anaconda3\Lib\re\_parser.py:464, in _parse_sub(source, state, verbose, nested)
    462 start = source.tell()
    463 while True:
--> 464     itemsappend(_parse(source, state, verbose, nested + 1,
    465                        not nested and not items))
    466     if not sourcematch("|"):
    467         break

File D:\76043\anaconda3\Lib\re\_parser.py:872, in _parse(source, state, verbose, nested, first)
    869     group = None
    870 sub_verbose = ((verbose or (add_flags & SRE_FLAG_VERBOSE)) and
    871                not (del_flags & SRE_FLAG_VERBOSE))
--> 872 p = _parse_sub(source, state, sub_verbose, nested + 1)
    873 if not source.match(")"):
    874     raise source.error("missing ), unterminated subpattern",
    875                        source.tell() - start)

File D:\76043\anaconda3\Lib\re\_parser.py:464, in _parse_sub(source, state, verbose, nested)
    462 start = source.tell()
    463 while True:
--> 464     itemsappend(_parse(source, state, verbose, nested + 1,
    465                        not nested and not items))
    466     if not sourcematch("|"):
    467         break

File D:\76043\anaconda3\Lib\re\_parser.py:548, in _parse(source, state, verbose, nested, first)
    545         continue
    547 if this[0] == "\":
--> 548     code = _escape(source, this, state)
    549     subpatternappend(code)
    551 elif this not in SPECIAL_CHARS:

File D:\76043\anaconda3\Lib\re\_parser.py:432, in _escape(source, escape, state)
    430         c = int(escape[1:], 8)
    431         if c > 0o377:
--> 432             raise source.error('octal escape value %s outside of '
    433                                'range 0-0o377' % escape,
    434                                len(escape))
    435         return LITERAL, c
    436 # not an octal escape, so this is a group reference

error: octal escape value \760 outside of range 0-0o377 at position 28

已查阅Stack Overflow相关解决方案但均无效,pip install numpy可正常运行,求该问题的解决办法。

内容的提问来源于stack exchange,提问作者Y H

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.19 23:05:04