安装 SciPy 和 scikit-learn 升级pip 及pip基本命令表

时间:2023-03-08 15:38:26

安装Scipy和scikit-learn出错,出错记录及当时最终解决办法

问题:

一、使用pip直接安装

  直接pip install scipy  

C:\Users\Plain>pip install scripy
Collecting scripy
Downloading Scripy-0.9.3.tar.gz
Complete output from command python setup.py egg_info:Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\plain\appdata\local\temp\pip-build-bqakt2\scripy\setup.py",line 96, in <module>
description=get_description(packages[0], PACKAGE_DIR),
File "c:\users\plain\appdata\local\temp\pip-build-bqakt2\scripy\setup.py",line 47, in get_description
pkg = __import__(package, level=1)
File "c:\users\plain\appdata\local\temp\pip-build-bqakt2\scripy\lib\scripy\__init__.py", line 11, in <module>
from .edit import *
File "c:\users\plain\appdata\local\temp\pip-build-bqakt2\scripy\lib\scripy\edit.py", line 15, in <module>
import pwd
ImportError: No module named pwd
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\plain\appdata\local\temp\pip-build-bqakt2\scripy\

  显示错误后,也没有仔细分析问题原因,能力欠缺。

解决:

二、使用.whl文件安装

  在网站下载scipy.whl 软件http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy

  然后在msdos中直接:pip install (将下载好的.whl文件拖入即可)

  安装失败:显示:  

C:\Users\Plain>pip install C:\Users\Plain\Desktop\scipy-0.17.-cp27-cp27m-win_amd64.whl
scipy-0.17.-cp27-cp27m-win_amd64.whl is not a supported wheel on this platform.
You are using pip version 7.1., however version 8.1. is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

  在刚才下载的网上查阅了关于安装有:Use pip version 8 or newer to install the downloaded .whl files.

  大意就是使用pip version 8 或者最新版本(我的是7.1.2,当时最新8.1.2),可能是pip过旧的原因

解决续:

三,升级pip,及部分pip命令学习

  按照上边的升级提示:

  python -m pip install --update pip

  果然最后显示:Successfully installed pip-8.1.2

  然后查看pip版本 使用pip -V

  如果命令出错会显示所有的pip 命令:

  

 C:\Users\Plain>pip -v

 Usage:
pip <command> [options] Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format # 输出已安装的软件包的需求格式
list List installed packages.    # 类似于freeze
show Show information about installed packages.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion
help Show help for commands. General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring
environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be
used up to times.
-V, --version Show version and exit.
-q, --quiet Give less output.
--log <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form
[user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should
attempt (default times).
--timeout <sec> Set the socket timeout (default seconds).
--exists-action <action> Default action when a path already exists:
(s)witch, (i)gnore, (w)ipe, (b)ackup.
--trusted-host <hostname> Mark this host as trusted, even though it does
not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file
containing the private key and the certificate
in PEM format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine
whether a new version of pip is available for
download. Implied with --no-index. C:\Users\Plain>pip -V
pip 8.1.2 from c:\python27\lib\site-packages (python 2.7)

四、直接使用pip需要将pip添加到系统环境变量path中

----------------2016-7-24 12:29:40--

    source: