好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 知識庫 > 解決jupyter加載文件失敗的問題

解決jupyter加載文件失敗的問題

熱門標簽:千陽自動外呼系統 江蘇客服外呼系統廠家 原裝電話機器人 平頂山外呼系統免費 工廠智能電話機器人 400電話申請服務商選什么 清遠360地圖標注方法 在哪里辦理400電話號碼 西藏智能外呼系統五星服務

遇到個小白常見的問題,發現度娘里面沒有記錄,翻墻谷歌了下,解決問題,在此寫個說明。

事情起因:

在jupyter notebook中導入文件時發生了錯誤:

%load p2_test1.py

錯誤信息:

---------------------------------------------------------------------------
NameError                 Traceback (most recent call last)
/usr/local/lib/python3.5/dist-packages/IPython/core/interactiveshell.py in find_user_code(self, target, raw, py_only, skip_encoding_cookie, search_ns)
  3586     try:                       # User namespace
-> 3587       codeobj = eval(target, self.user_ns)
  3588     except Exception:
 
string> in module>
 
NameError: name 'p2_test1' is not defined
 
During handling of the above exception, another exception occurred:
 
ValueError                Traceback (most recent call last)
ipython-input-1-e4e531e2ca85> in module>
----> 1 get_ipython().run_line_magic('load', 'p2_test1.py')
 
/usr/local/lib/python3.5/dist-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
  2285         kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
  2286       with self.builtin_trap:
-> 2287         result = fn(*args,**kwargs)
  2288       return result
  2289 
 
decorator-gen-47> in load(self, arg_s)
 
/usr/local/lib/python3.5/dist-packages/IPython/core/magic.py in lambda>(f, *a, **k)
  185   # but it's overkill for just that one bit of state.
  186   def magic_deco(arg):
--> 187     call = lambda f, *a, **k: f(*a, **k)
  188 
  189     if callable(arg):
 
/usr/local/lib/python3.5/dist-packages/IPython/core/magics/code.py in load(self, arg_s)
  333     search_ns = 'n' in opts
  334 
--> 335     contents = self.shell.find_user_code(args, search_ns=search_ns)
  336 
  337     if 's' in opts:
 
/usr/local/lib/python3.5/dist-packages/IPython/core/interactiveshell.py in find_user_code(self, target, raw, py_only, skip_encoding_cookie, search_ns)
  3588     except Exception:
  3589       raise ValueError(("'%s' was not found in history, as a file, url, "
-> 3590                 "nor in the user namespace.") % target)
  3591 
  3592     if isinstance(codeobj, str):
 
ValueError: 'p2_test1.py' was not found in history, as a file, url, nor in the user namespace.

出現這個問題是因為解釋器找不到對應的文件。念了“媽咪媽咪轟”pwd后,發現問題所在:

%pwd 
ll

pwd顯示當前目錄不是該文件所在的目錄。這下明白了,使用咒語要謹慎,記得在念“媽咪媽咪轟”load前,要cd到該文件的目錄下去。

參考

補充:Jupyter Notebook - sns.load_dataset加載文件錯誤解決方法

seaborn模塊中sns.load_dataset加載文件錯誤解決方法:

import seaborn as sns
data = sns.load_dataset("iris")

出現錯誤:

URLError: urlopen error [Errno 11004] getaddrinfo failed>

出現原因:

seaborn-data文件夾里面是空的,可以另外下載該文件夾的內容復制到該文件夾中。

下載地址:

https://github.com/mwaskom/seaborn-data

下載位置:

電腦上搜索seaborn-data文件夾

將下載下來的文件解壓后全部放進seaborn-data文件夾

重新運行代碼,出現結果。

以上為個人經驗,希望能給大家一個參考,也希望大家多多支持腳本之家。如有錯誤或未考慮完全的地方,望不吝賜教。

您可能感興趣的文章:
  • Jupyter加載文件的實現方法
  • 切換路徑在Jupyter里調用本地文件的操作
  • 解決jupyter 在瀏覽器中 代碼不執行的問題
  • anaconda jupyter不能導入安裝的lightgbm解決方案
  • 終端能到import模塊 解決jupyter notebook無法導入的問題
  • jupyter讀取錯誤格式文件的解決方案

標簽:錦州 股票 隨州 安慶 白城 西安 日照 天水

巨人網絡通訊聲明:本文標題《解決jupyter加載文件失敗的問題》,本文關鍵詞  解決,jupyter,加載,文件,失,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《解決jupyter加載文件失敗的問題》相關的同類信息!
  • 本頁收集關于解決jupyter加載文件失敗的問題的相關信息資訊供網民參考!
  • 推薦文章