如何在windows cmd上从pip安装pandas? [英] How to install pandas from pip on windows cmd?

查看:40
本文介绍了如何在windows cmd上从pip安装pandas?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 pip 安装 Pandas 以运行一些基于 Pandas 的 Python 程序.我已经安装了pip.我尝试使用谷歌搜索和 SO'ing 但没有找到解决此错误的方法.有人可以分享您对此的意见吗?

C:>pip 安装熊猫

错误:

pip 不是内部或外部命令,也不是可运行的程序或批处理文件.

解决方案

由于 pippython 命令都没有安装在 Windows 中,因此您需要使用Windows 替代 py,它在您安装 Python 时默认包含.然后您可以选择在 py 命令后指定通用或特定版本号.

C:>py -m pip install pandas %= 系统上的 Python 之一 =%C:>py -2 -m pip install pandas %= 系统上的 Python 2 之一 =%C:>py -2.7 -m pip install pandas %= 仅适用于 Python 2.7 =%C:>py -3 -m pip install pandas %= 系统上的 Python 3 之一 =%C:>py -3.6 -m pip install pandas %= 仅适用于 Python 3.6 =%

或者,为了让 pip 在没有 py -m 部分的情况下工作,您需要 中运行pip,在安装时添加--user选项点.通常将软件包安装到本地 %APPDATA% Python 文件夹中.

C:>py -m pip install --user 熊猫

C:>py -m venv c:path	o
ewvenvC:><path	o	he
ewvenv>Scriptsactivate.bat

I am trying to install pandas using pip to run some pandas-based Python programs. I already installed pip. I tried googling and SO'ing but didn't find a solution to this error. Can somebody share your inputs on this?

C:> pip install pandas

Error:

pip is not recognized as an internal or external command, operable program or batch file.

解决方案

Since both pip nor python commands are not installed along Python in Windows, you will need to use the Windows alternative py, which is included by default when you installed Python. Then you have the option to specify a general or specific version number after the py command.

C:> py      -m pip install pandas  %= one of Python on the system =%
C:> py -2   -m pip install pandas  %= one of Python 2 on the system =%
C:> py -2.7 -m pip install pandas  %= only for Python 2.7 =%
C:> py -3   -m pip install pandas  %= one of Python 3 on the system =%
C:> py -3.6 -m pip install pandas  %= only for Python 3.6 =%

Alternatively, in order to get pip to work without py -m part, you will need to add pip to the PATH environment variable.

C:> setx PATH "%PATH%;C:<path	opythonfolder>Scripts"

Now you can run the following command as expected.

C:> pip install pandas


Troubleshooting:


Problem:

connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

Solution:

This is caused by your SSL certificate is unable to verify the host server. You can add pypi.python.org to the trusted host or specify an alternative SSL certificate. For more information, please see this post. (Thanks to Anuj Varshney for suggesting this)

C:> py -m pip install --trusted-host pypi.python.org pip pandas


Problem:

PermissionError: [WinError 5] Access is denied

Solution:

This is a caused by when you don't permission to modify the Python site-package folders. You can avoid this with one of the following methods:

  • Run Windows Command Prompt as administrator (thanks to DataGirl's suggestion) by:

    1. + R to open run
    2. type in cmd.exe in the search box
    3. CTRL + SHIFT + ENTER
    4. An alternative method for step 1-3 would be to manually locate cmd.exe, right click, then click Run as Administrator.

  • Run pip in user mode by adding --user option when installing with pip. Which typically install the package to the local %APPDATA% Python folder.

C:> py -m pip install --user pandas

C:> py -m venv c:path	o
ewvenv
C:> <path	o	he
ewvenv>Scriptsactivate.bat

这篇关于如何在windows cmd上从pip安装pandas?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆