【问题标题】:Encountered an error while installing jupyter notebook using pip使用 pip 安装 jupyter notebook 时遇到错误
【发布时间】:2019-11-18 15:13:43
【问题描述】:

错误:命令出错,退出状态为 1: 命令:'g:\python38\python.exe' -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'C:\Users\REVANTH SAI\AppData\Local\Temp\pip-install-5m2h9dud\pywinpty\setup.py'"'"'; 文件='"'"'C:\Users\REVANTH SAI\AppData\Local\Temp\pip-install-5m2h9dud\pywinpty\setup.py'"'"';f=getattr(tokenize , '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"' , '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\REVANTH SAI\AppData\Local\Temp\pip-install-5m2h9dud\pywinpty\pip-egg-info' cwd: C:\Users\REVANTH SAI\AppData\Local\Temp\pip-install-5m2h9dud\pywinpty\ 完整输出(147 行): 找不到pgen,不编译形式语法。 回溯(最近一次通话最后): 文件“g:\python38\lib\distutils\core.py”,第 148 行,在设置中 dist.run_commands() 文件“g:\python38\lib\distutils\dist.py”,第 966 行,在 run_commands self.run_command(cmd) 文件“g:\python38\lib\distutils\dist.py”,第 985 行,在 run_command cmd_obj.run() 运行中的文件“g:\python38\lib\site-packages\setuptools\command\bdist_egg.py”,第 163 行 self.run_command("egg_info") 文件“g:\python38\lib\distutils\cmd.py”,第 313 行,在 run_command self.distribution.run_command(command) 文件“g:\python38\lib\distutils\dist.py”,第 985 行,在 run_command cmd_obj.run() 运行中的文件“g:\python38\lib\site-packages\setuptools\command\egg_info.py”,第 283 行 self.mkpath(self.egg_info) mkpath 中的文件“g:\python38\lib\distutils\cmd.py”,第 338 行 dir_util.mkpath(名称,模式,dry_run=self.dry_run) mkpath 中的文件“g:\python38\lib\distutils\dir_util.py”,第 70 行 os.mkdir(头,模式) 文件“g:\python38\lib\site-packages\setuptools\sandbox.py”,第 310 行,打包 path = self._remap_input(name, path, *args, **kw) _remap_input 中的文件“g:\python38\lib\site-packages\setuptools\sandbox.py”,第 452 行 self._violation(操作,os.path.realpath(路径),*args,**kw) _violation 中的文件“g:\python38\lib\site-packages\setuptools\sandbox.py”,第 407 行 引发 SandboxViolation(操作,参数,kw) setuptools.sandbox.SandboxViolation: SandboxViolation: mkdir('C:\Users\REVANT~1\AppData\Local\Temp\easy_install-q_7oforc\Cython-0.29.14\Cython.egg-info', 511) {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "g:\python38\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
    yield saved
  File "g:\python38\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
    yield
  File "g:\python38\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "g:\python38\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "C:\Users\REVANT~1\AppData\Local\Temp\easy_install-q_7oforc\Cython-0.29.14\setup.py", line 228, in <module>        File "g:\python38\lib\site-packages\setuptools\__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "g:\python38\lib\distutils\core.py", line 163, in setup
    raise SystemExit("error: " + str(msg))
SystemExit: error: SandboxViolation: mkdir('C:\\Users\\REVANT~1\\AppData\\Local\\Temp\\easy_install-q_7oforc\\Cython-0.29.14\\Cython.egg-info', 511) {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "g:\python38\lib\site-packages\setuptools\command\easy_install.py", line 1144, in run_setup
    run_setup(setup_script, args)
  File "g:\python38\lib\site-packages\setuptools\sandbox.py", line 253, in run_setup
    raise
  File "g:\python38\lib\contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "g:\python38\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
    yield
  File "g:\python38\lib\contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "g:\python38\lib\site-packages\setuptools\sandbox.py", line 166, in save_modules
    saved_exc.resume()
  File "g:\python38\lib\site-packages\setuptools\sandbox.py", line 141, in resume
    six.reraise(type, exc, self._tb)
  File "g:\python38\lib\site-packages\setuptools\_vendor\six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "g:\python38\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
    yield saved
  File "g:\python38\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
    yield
  File "g:\python38\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "g:\python38\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "C:\Users\REVANT~1\AppData\Local\Temp\easy_install-q_7oforc\Cython-0.29.14\setup.py", line 228, in <module>        File "g:\python38\lib\site-packages\setuptools\__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "g:\python38\lib\distutils\core.py", line 163, in setup
    raise SystemExit("error: " + str(msg))
SystemExit: error: SandboxViolation: mkdir('C:\\Users\\REVANT~1\\AppData\\Local\\Temp\\easy_install-q_7oforc\\Cython-0.29.14\\Cython.egg-info', 511) {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\REVANTH SAI\AppData\Local\Temp\pip-install-5m2h9dud\pywinpty\setup.py", line 68, in <module>               setup(
  File "g:\python38\lib\site-packages\setuptools\__init__.py", line 144, in setup
    _install_setup_requires(attrs)
  File "g:\python38\lib\site-packages\setuptools\__init__.py", line 139, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "g:\python38\lib\site-packages\setuptools\dist.py", line 716, in fetch_build_eggs
    resolved_dists = pkg_resources.working_set.resolve(
  File "g:\python38\lib\site-packages\pkg_resources\__init__.py", line 780, in resolve
    dist = best[req.key] = env.best_match(
  File "g:\python38\lib\site-packages\pkg_resources\__init__.py", line 1065, in best_match
    return self.obtain(req, installer)
  File "g:\python38\lib\site-packages\pkg_resources\__init__.py", line 1077, in obtain
  File "g:\python38\lib\site-packages\setuptools\dist.py", line 786, in fetch_build_egg
    return cmd.easy_install(req)
  File "g:\python38\lib\site-packages\setuptools\command\easy_install.py", line 679, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "g:\python38\lib\site-packages\setuptools\command\easy_install.py", line 705, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "g:\python38\lib\site-packages\setuptools\command\easy_install.py", line 890, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "g:\python38\lib\site-packages\setuptools\command\easy_install.py", line 1158, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "g:\python38\lib\site-packages\setuptools\command\easy_install.py", line 1146, in run_setup
    raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with error: SandboxViolation: mkdir('C:\\Users\\REVANT~1\\AppData\\Local\\Temp\\easy_install-q_7oforc\\Cython-0.29.14\\Cython.egg-info', 511) {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.

----------------------------------------

错误:命令出错,退出状态为 1:python setup.py egg_info 检查日志以获取完整的命令输出。

【问题讨论】:

  • 你能添加你用于安装的命令吗?另外请确保格式在您的问题中是适当的(使用代码格式来获取完整的错误消息,并添加一段关于您的设置和您尝试过的命令)

标签: python-3.x pip jupyter-notebook


【解决方案1】:

您需要先更新您的setuptools

pip install setuptools --upgrade

python 3.8 中的一个更改导致旧版本的 setuptools 出现此问题。

【讨论】:

    【解决方案2】:

    我在 Windows 10 上,并使用 Pyhton 3.8。先运行

    pip install setuptools --upgrade
    

    然后

    pip install notebook
    

    对我很有效。感谢@roberto

    【讨论】:

      猜你喜欢
      • 2022-12-01
      • 2020-12-22
      • 2018-10-15
      • 2018-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-29
      • 1970-01-01
      相关资源
      最近更新 更多