如何使用Pip下载和安装Python软件包和模块以及pip无法下载的软件包和模块?

时间:2017-10-23 20:12:56

标签: python python-2.7 python-3.x

我正在尝试使用pip安装模块来运行一些基于ML的python程序。有人可以就此分享您的意见。我尝试使用谷歌搜索,但没有找到解决方案...任何帮助将不胜感激。感谢。

PS: - 我已经安装了pip。

2 个答案:

答案 0 :(得分:1)

你可以去安装python的路径,例如:

>>cd c:/users/demongking/python3/scripts
>>c:/users/demongking/python3/scripts>pip install pandas

您也可以转到http://www.lfd.uci.edu/~gohlke/pythonlibs/并下载滚轮文件(.whl)然后转到您的下载目录,然后您可以执行以下操作:

>>c:/users/demonking/downloads>>c:/users/demongking/python3/scripts/pip 
install modulename.whl

或者,您可以下载setup.py文件,然后转到cmd并将目录更改为下载安装文件的位置,然后键入

>>python setup.py install

如果您安装了多个版本,请务必写下python版本的全名

或者您也可以这样做:

>>py -version -m pip install modulename

其中-version是你的python版本

如果要直接通过cmd将pip识别为命令,则必须更改PATH系统变量

>>In Search, search for and then select: System (Control Panel)
>>Click the Advanced system settings link.
>>Click Environment Variables. In the section System Variables, find the 
  PATH environment variable and select it. Click Edit. If the PATH 
  environment variable does not exist, click New.
>>In the Edit System Variable (or New System Variable) window, specify the 
  value of the PATH environment variable. Click OK. Close all remaining 
  windows by clicking OK.

路径将包含pip的位置。例如,它将是这样的

  

C:/用户/ demongking / python3 /脚本/ PIP

答案 1 :(得分:0)

如果问题是安装需要编译代码的软件包,还有其他选择:

anaconda - 带有替代包管理器的python发行版

gohlke - 许多python模块的预构建Windows包的集合