【问题标题】:pip install pods command failed in jupyter with FileNotFoundError: [Errno 2] No such file or directory: 'C:\\tmp\\sods.log'pip install pods 命令在 jupyter 中因 FileNotFoundError 失败:[Errno 2] 没有这样的文件或目录:'C:\\tmp\\sods.log'
【发布时间】:2021-06-14 01:27:34
【问题描述】:

我尝试使用以下命令在 jupyter notebook 中安装 pods 包:

   pip install pods 

   import pods

安装失败,出现以下错误

       ---------------------------------------------------------------------------
    FileNotFoundError                         Traceback (most recent call last)
    <ipython-input-3-c6cba4dfa9c3> in <module>
      1 get_ipython().run_line_magic('matplotlib', 'inline')
----> 2 import pods
      3 import matplotlib.pyplot as plt

~\anaconda3\lib\site-packages\pods\__init__.py in <module>
----> 1 from . import datasets
      2 from . import mocap

~\anaconda3\lib\site-packages\pods\datasets.py in <module>
     17 import logging
     18 
---> 19 logging.basicConfig(
     20     level=logging.DEBUG,
     21     format="%(asctime)s %(levelname)s %(message)s",

~\anaconda3\lib\logging\__init__.py in basicConfig(**kwargs)
   1974                 mode = kwargs.pop("filemode", 'a')
   1975                 if filename:
-> 1976                     h = FileHandler(filename, mode)
   1977                 else:
   1978                     stream = kwargs.pop("stream", None)

~\anaconda3\lib\logging\__init__.py in __init__(self, filename, mode, encoding, delay)
   1141             self.stream = None
   1142         else:
-> 1143             StreamHandler.__init__(self, self._open())
   1144 
   1145     def close(self):

 ~\anaconda3\lib\logging\__init__.py in _open(self)
   1170         Return the resulting stream.
   1171         """
-> 1172         return open(self.baseFilename, self.mode, encoding=self.encoding)
   1173 
   1174     def emit(self, record):


 FileNotFoundError: [Errno 2] No such file or directory: 'C:\\tmp\\sods.log'

我尝试使用! pip install pods --user 命令安装 pods 包,但问题仍然存在。谁能提供您解决问题的见解?

【问题讨论】:

  • 看起来c:\\tmp 被用作写入日志的硬编码路径。您是否尝试过创建该文件夹?
  • 我尝试创建文件夹并成功执行。谢谢
  • 我将其发布为答案,以便您将其标记为已接受

标签: python anaconda package jupyter


【解决方案1】:

问题是日志文件的路径在源代码中是硬编码的,如github 所示。但是,默认情况下 Windows 中不存在路径 C:\\tmp

最简单的解决方案就是在你的 C 盘上创建一个 tmp 文件夹

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-14
    • 1970-01-01
    • 1970-01-01
    • 2019-11-03
    • 2021-08-24
    • 2021-03-07
    相关资源
    最近更新 更多