【问题标题】:Installing Pandas in pyCharm giving error Microsoft Visual C++ 10.0在 pyCharm 中安装 Pandas 时出现错误 Microsoft Visual C++ 10.0
【发布时间】:2019-05-27 14:11:14
【问题描述】:

我正在尝试在 pyCharm 中安装 pandas,但是我不断收到以下错误消息:

error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279

现在我已经通过他们提供给我的链接下载并安装了 Microsoft Visual C++ 10.0,但是我仍然遇到同样的错误。我什至尝试从 pyCharm 的终端安装它,它给出以下内容:

(python.exe) C:\Users\danie\Desktop\Python>pip install pandas
Requirement already satisfied: pandas in c:\users\danie\appdata\local\programs\python\python37-32\lib\site-packages (0.23.4)
Requirement already satisfied: python-dateutil>=2.5.0 in c:\users\danie\appdata\local\programs\python\python37-32\lib\site-packages (from pandas) (2.7.5)
Requirement already satisfied: numpy>=1.9.0 in c:\users\danie\appdata\local\programs\python\python37-32\lib\site-packages (from pandas) (1.15.4)
Requirement already satisfied: pytz>=2011k in c:\users\danie\appdata\local\programs\python\python37-32\lib\site-packages (from pandas) (2018.7)
Requirement already satisfied: six>=1.5 in c:\users\danie\appdata\local\programs\python\python37-32\lib\site-packages (from python-dateutil>=2.5.0->pandas) (1.12.0)
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

我也尝试过升级 pip 但这就是显示的内容:

(python.exe) C:\Users\danie\Desktop\Python>python -m pip install --upgrade pip
Requirement already up-to-date: pip in c:\miniconda3\envs\my_env\python.exe\lib\site-packages (18.1)

我多次重启电脑。

(python.exe) C:\Users\danie\Desktop\Python>SET
FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
CommonProgramFiles=C:\Program Files\Common Files
SESSIONNAME=Console
COMPUTERNAME=DESKTOP-0OV717O
TMP=C:\Users\danie\AppData\Local\Temp
VBOX_MSI_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\
OneDriveConsumer=C:\Users\danie\OneDrive
__INTELLIJ_COMMAND_HISTFILE__=C:\Users\danie\.PyCharm2018.3\config\terminal\history\history-
SystemDrive=C:
NUMBER_OF_PROCESSORS=8
LOGONSERVER=\\DESKTOP-0OV717O
TEMP=C:\Users\danie\AppData\Local\Temp
ProgramW6432=C:\Program Files
HOMEPATH=\Users\danie
_OLD_VIRTUAL_PROMPT=$P$G
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
_OLD_VIRTUAL_PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Intel\iCLS Client\
;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C
:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;D:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\
Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\P
rogram Files\Intel\Intel(R) Management Engine Components\IPT;D:\Program Files\JRE\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\
NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Microsoft Windows Performance Toolkit\;C:\Users\danie\AppData\Local\Programs\Python\Launcher\;D:\Program Files\Python3;C:\Users\danie\App
Data\Local\Programs\Python\Python37-32\Scripts;
USERNAME=danie
ProgramFiles=C:\Program Files
USERDOMAIN_ROAMINGPROFILE=DESKTOP-0OV717O
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
LOCALAPPDATA=C:\Users\danie\AppData\Local
TERMINAL_EMULATOR=JetBrains-JediTerm
VIRTUAL_ENV=C:\Miniconda3\envs\my_env\python.exe
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 158 Stepping 9, GenuineIntel
DriverData=C:\Windows\System32\Drivers\DriverData
APPDATA=C:\Users\danie\AppData\Roaming
ALLUSERSPROFILE=C:\ProgramData
USERDOMAIN=DESKTOP-0OV717O
PROCESSOR_LEVEL=6
ProgramData=C:\ProgramData
ComSpec=C:\WINDOWS\system32\cmd.exe
PROCESSOR_ARCHITECTURE=AMD64
FPS_BROWSER_USER_PROFILE_STRING=Default
SystemRoot=C:\WINDOWS
GOOGLE_API_KEY=no
PROCESSOR_REVISION=9e09
OneDrive=C:\Users\danie\OneDrive
GOOGLE_DEFAULT_CLIENT_ID=no
PROJECT_DIR=C:/Users/danie/Desktop/Python
PATH=C:\Miniconda3\envs\my_env\python.exe\Scripts;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\ProgramData\Oracle\Java\javapath;C:\
Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;D:\Program Files\Git\cmd;C:\WINDOWS\System32\
OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Manag
ement Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;D:\Program Files\JRE\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\W
irelessCommon\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Microsoft Windows Performance Toolkit\;C:\Users\danie\AppData\Local\Programs\Python\Launcher\;D:\Program
Files\Python3;C:\Users\danie\AppData\Local\Programs\Python\Python37-32\Scripts;
ProgramFiles(x86)=C:\Program Files (x86)
USERPROFILE=C:\Users\danie
CommonProgramW6432=C:\Program Files\Common Files
windir=C:\WINDOWS
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
OS=Windows_NT
asl.log=Destination=file
PUBLIC=C:\Users\Public
PROMPT=(python.exe) $P$G
HOMEDRIVE=C:
GOOGLE_DEFAULT_CLIENT_SECRET=no

【问题讨论】:

  • 你重启电脑了吗?没有它,它将无法工作(可能)
  • 是的,我做到了......''是的,我多次重启电脑''
  • 检查开始菜单中是否有类似“VS 的命令提示符...”的内容。确保已正确安装构建工具(Program Files 中 Microsoft Visual Studio 的子文件夹之一),可能是 Program Files 文件夹中的 Microsoft Visual Studio\2017\BuildTools
  • @Shan 是的,我有那个 ''VS 的命令提示符'' 正确安装构建工具是什么意思?

标签: python pandas pycharm runtime-error


【解决方案1】:

您似乎正在运行 Anaconda 环境,但尝试通过 pip 安装模块。这是一种不好的做法,尤其是在 Windows 上。 Anaconda 还为您的环境提供二进制、非 Python 依赖项。

正确的做法:

  1. 激活您的虚拟环境
  2. 安装熊猫:conda install pandas

话虽如此,您的方式虽然不推荐,但也应该可行。要进行故障排除,请在命令行中运行:

  1. vcvarsall.bat 并呈现输出。
  2. SET。这将为我们提供所有环境变量。

[编辑 - 后果]

通过 Anaconda 命令提示符安装模块,而不是 PyCharm。 PyCharm 不会加载构建包所需的环境变量。

【讨论】:

  • 我尝试按照您的建议进行这两项操作,结果如下:(python.exe) C:\Users\danie\Desktop\Python> vcvarsall.bat 'vcvarsall.bat' is not recognized as an internal or external command, operable program or batch file.(python.exe) C:\Users\danie\Desktop\Python>conda install pandas 'conda' is not recognized as an internal or external command, operable program or batch file.
  • @DavidVella 你能启动 Anaconda 控制台吗?它应该在您的开始菜单下。
  • 通过 anacondas 终端它确实安装但不是通过 pyCharm
  • @DavidVella 你的 PyCharm 应该指向你的 virtualenv,在 IDE 中设置正确的解释器。不过,我不会尝试通过 PyCharm 安装任何东西。如您的示例所示,它不会设置环境变量。这能回答你的问题吗?
  • 我尝试按照您的建议进行操作,并成功从 anaconda 下载了所有内容,但是现在在 pycharm 上打开和加载环境时出现此错误ImportError: Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of numpy. If you're working with a numpy git repo, try git clean -xdf`(删除所有不受版本控制的文件)。否则重新安装numpy。原始错误是:DLL 加载失败:找不到指定的模块。 Process finished with exit code 1` P.S 安装的 numpy 是最新的
【解决方案2】:

当我尝试使用 pandas 运行我的 python 程序时,我遇到了同样的错误(缺少 Visual C++...)。我已成功使用命令行:pip install pandas,但仍然出现错误。重新启动计算机无法解决此问题。 所以我决定放弃这个IDE,PyCharm。相反,我安装了 IDE“Visual Studio Code”,然后错误消失了。

【讨论】:

    猜你喜欢
    • 2019-12-26
    • 2020-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-30
    • 1970-01-01
    • 2019-01-08
    相关资源
    最近更新 更多