简体   繁体   English

无法在 Jupyter Notebook 中导入或安装 pandas-profiling

[英]Cannot import or install pandas-profiling in Jupyter Notebook

I have technically already installed pandas-profiling using我已经在技术上安装了 pandas-profiling 使用

pip install pandas-profiling

But when I try to import it, I get the following error:但是当我尝试导入它时,出现以下错误:

import numpy as np
import pandas as pd
import pandas_profiling
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-e1a23f2a6f04> in <module>()
  1 import numpy as np
  2 import pandas as pd
  3 import pandas_profiling

  ModuleNotFoundError: No module named 'pandas_profiling'

First Error Image第一个错误图像

So I tried installing it in Jupyter Notebook and got the following error as well:所以我尝试在 Jupyter Notebook 中安装它,但也出现了以下错误:

import sys
!{sys.executable} -m pip install pandas-profiling

 Collecting pandas-profiling
 Could not find a version that satisfies the requirement pandas-profiling 
 (from versions: )
 No matching distribution found for pandas-profiling

Second Error Image第二个错误图像

I am also unable to install it using conda for both as I am unable to establish a connection to conda.anaconda.org for some reason.我也无法使用 conda 安装它,因为出于某种原因我无法建立到 conda.anaconda.org 的连接。

To others who are looking to resolve this issue try these alternate steps :对于希望解决此问题的其他人,请尝试以下替代步骤:

  1. Run pip install pandas-profiling command in a separate cell in the jupyter notebook.在 jupyter notebook 的单独单元格中运行pip install pandas-profiling命令。
  2. After this just restart the kernal and run again.在此之后只需重新启动内核并再次运行。 This should definitely work.这绝对有效。 Worked for me.为我工作。

Based on the comments I was able to figure out the issue.根据评论,我能够找出问题所在。 I had to install jupyter notebook outside of the Anaconda root env and open it from the terminal.我必须在 Anaconda root env 之外安装 jupyter notebook 并从终端打开它。

pip3 install jupyter notebook

Once I did that it imported properly.一旦我这样做了,它就会正确导入。

Steps:脚步:

  1. Download the ZIP下载 ZIP
  2. Open Anaconda Prompt and go to the directory and extract the files to a folder打开 Anaconda Prompt 并转到目录并将文件解压缩到一个文件夹中

cd C:\\Users\\farah\\Downloads\\pandas-profiling-master\\pandas-profiling-master cd C:\\Users\\farah\\Downloads\\pandas-profiling-master\\pandas-profiling-master

  1. Then type python setup.py install然后输入 python setup.py install

  2. Now you can use:现在您可以使用:

 import pandas_profiling as pp df = pd.read_csv('1234.csv') pp.ProfileReport(df)

Reference: Pandas profiling参考: Pandas 分析

!pip install pandas_profiling  # Run this from Jupytor notebook Ignore the warnings if any 
from pandas_profiling import ProfileReport #restart the kernel if throws error
ProfileReport(df)  

Note: This worked for me on Windows 10注意:这在 Windows 10 上对我有用

错误:由于 EnvironmentError 无法安装软件包:[WinError 5] Acceso denegado: 'C:\\Users\\Majo\\anaconda3\\Lib\\site-packages\\matplotlib\\ft2font.cp37-win_amd64.pyd' 考虑使用--user选项或检查权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM