无法在本地安装 Google Colab

时间:2021-01-06 12:26:23

标签: python python-3.x pandas windows google-colaboratory

我一直在尝试在我的计算机(Windows 操作系统)上安装 google-colab 失败。

运行“pip install google-colab”时的输出很长,但我收到的一些错误是:

> Building wheel for pandas (setup.py) ... error   ERROR: Command
> errored out with exit status 1:    command:
> 'C:\Users\...\Anaconda3\python.exe' -u -c 'import sys, setuptools,
> tokenize; sys.argv[0] =
> '"'"'C:\\Users\\...\\AppData\\Local\\Temp\\pip-install-ifymdm95\\pandas\\setup.py'"'"';
> __file__='"'"'C:\\Users\\...\\AppData\\Local\\Temp\\pip-install-ifymdm95\\pandas\\setup.py'"'"';f=getattr(tokenize,
> '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
> '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
> bdist_wheel -d 'C:\Users\...\AppData\Local\Temp\pip-wheel-02i01qsx'

然后经过很长的错误输出,最后是:

 Rolling back uninstall of pandas
  Moving to c:\users\...\anaconda3\lib\site-packages\pandas-1.2.0.dist-info\
   from C:\Users\...\Anaconda3\Lib\site-packages\~andas-1.2.0.dist-info
  Moving to c:\users\...\anaconda3\lib\site-packages\pandas\
   from C:\Users\...\Anaconda3\Lib\site-packages\~-ndas
ERROR: Command errored out with exit status 1: 'C:\Users\...\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\...\\AppData\\Local\\Temp\\pip-install-ifymdm95\\pandas\\setup.py'"'"'; __file__='"'"'C:\\Users\\...\\AppData\\Local\\Temp\\pip-install-ifymdm95\\pandas\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\...\AppData\Local\Temp\pip-record-67jzzkdh\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\...\Anaconda3\Include\pandas' Check the logs for full command output.

任何提示或帮助将不胜感激。

1 个答案:

答案 0 :(得分:2)

来自 Colab's issues repo,Craig Citro(Google Colab 的软件工程师)陈述了以下内容

<块引用>

无法在本地运行 colab 前端。

但是,请注意,Colaboratory 允许您使用 Jupyter 连接到本地运行时。这允许您在本地硬件上执行代码并访问本地文件系统(它是具有本地运行时的 Colab 前端)。如果这是您的目标,here您可以找到实现目标的方法。

<块引用>

设置说明

为了允许 Colaboratory 连接到您本地运行的 Jupyter 服务器,您需要执行以下步骤。

第 1 步: 安装 Jupyter 在本地机器上安装 Jupyter。

第 2 步:安装并启用 jupyter_http_over_ws jupyter 扩展(一次性) jupyter_http_over_ws 扩展由 Colaboratory 团队编写,可在 GitHub 上使用。

pip install jupyter_http_over_ws
jupyter serverextension enable --py jupyter_http_over_ws

第 3 步:启动服务器并进行身份验证

新的笔记本服务器正常启动,但您需要设置一个标志以明确信任来自 Colaboratory 前端的 WebSocket 连接。

jupyter notebook \
  --NotebookApp.allow_origin='https://colab.research.google.com' \
  --port=8888 \
  --NotebookApp.port_retries=0

一旦服务器启动,它将打印一条带有初始信息的消息 用于身份验证的后端 URL。复制此 URL 需要在下一步中提供此信息。第四步:连接本地 运行时

在 Colaboratory 中,单击“连接”按钮并选择“连接到 本地运行时...”。在对话框中输入上一步中的 URL 出现并单击“连接”按钮。在这之后,你应该 现在连接到您的本地运行时。

相关问题