您的位置:首页 > 编程语言 > Python开发

在mac上安装Python下的模块管理工具pip

2017-05-21 03:23 846 查看
这里"https://bootstrap.pypa.io"将
get-pip.py
文件取下来,执行

MikedeMacBook-Pro:~ mike_lee$ pip

-bash: pip: command not found

MikedeMacBook-Pro:Downloads mike_lee$
sudo python get-pip.py 

Password:

The directory '/Users/mike_lee/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want
sudo's -H flag.

The directory '/Users/mike_lee/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's
-H flag.

Collecting pip

  Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)

    100% |████████████████████████████████| 1.3MB 410kB/s 

Collecting wheel

  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)

    100% |████████████████████████████████| 71kB 1.0MB/s 

Installing collected packages: pip, wheel

Successfully installed pip-9.0.1 wheel-0.29.0

MikedeMacBook-Pro:Downloads mike_lee$
pip

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.

  show                        Show information about installed packages.

  check                       Verify installed packages have compatible dependencies.

  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 3 times.

  -V, --version               Show version and exit.

  -q, --quiet                 Give less output. Option is additive, and can be

                              used up to 3 times (corresponding to WARNING,

                              ERROR, and CRITICAL logging levels).

  --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 5 times).

  --timeout <sec>             Set the socket timeout (default 15 seconds).

  --exists-action <action>    Default action when a path already exists:

                              (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.

  --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.

MikedeMacBook-Pro:Downloads mike_lee$ 

使用PIP安装python插件:

MikedeMacBook-Pro:Downloads mike_lee$
sudo pip install pyserial

Password:

The directory '/Users/mike_lee/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want
sudo's -H flag.

The directory '/Users/mike_lee/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's
-H flag.

Collecting pyserial

  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10ba7e650>: Failed to establish a new connection:
[Errno 8] nodename nor servname provided, or not known',)': /simple/pyserial/

  Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10ba7eb90>: Failed to establish a new connection:
[Errno 8] nodename nor servname provided, or not known',)': /simple/pyserial/

  Downloading pyserial-3.3-py2.py3-none-any.whl (189kB)

    100% |████████████████████████████████| 194kB 587kB/s 

Installing collected packages: pyserial

Successfully installed pyserial-3.3

MikedeMacBook-Pro:Downloads mike_lee$ 

MikedeMacBook-Pro:Downloads mike_lee$
sudo pip install psutil

Password:

The directory '/Users/mike_lee/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want
sudo's -H flag.

The directory '/Users/mike_lee/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's
-H flag.

Collecting psutil

  Downloading psutil-5.2.2.tar.gz (348kB)

    100% |████████████████████████████████| 358kB 289kB/s 

Installing collected packages: psutil

  Running setup.py install for psutil ... done

Successfully installed psutil-5.2.2

MikedeMacBook-Pro:Downloads mike_lee$ 

MikedeMacBook-Pro:Downloads mike_lee$
sudo pip install Flask

The directory '/Users/mike_lee/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want
sudo's -H flag.

The directory '/Users/mike_lee/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner
ab8d
of that directory. If executing pip with sudo, you may want sudo's
-H flag.

Collecting Flask

  Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB)

    100% |████████████████████████████████| 92kB 175kB/s 

Collecting itsdangerous>=0.21 (from Flask)

  Downloading itsdangerous-0.24.tar.gz (46kB)

    100% |████████████████████████████████| 51kB 332kB/s 

Collecting Werkzeug>=0.7 (from Flask)

  Downloading Werkzeug-0.12.2-py2.py3-none-any.whl (312kB)

    100% |████████████████████████████████| 317kB 260kB/s 

Collecting Jinja2>=2.4 (from Flask)

  Downloading Jinja2-2.9.6-py2.py3-none-any.whl (340kB)

    100% |████████████████████████████████| 348kB 355kB/s 

Collecting click>=2.0 (from Flask)

  Downloading click-6.7-py2.py3-none-any.whl (71kB)

    100% |████████████████████████████████| 71kB 467kB/s 

Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->Flask)

  Downloading MarkupSafe-1.0.tar.gz

Installing collected packages: itsdangerous, Werkzeug, MarkupSafe, Jinja2, click, Flask

  Running setup.py install for itsdangerous ... done

  Running setup.py install for MarkupSafe ... done

Successfully installed Flask-0.12.2 Jinja2-2.9.6 MarkupSafe-1.0 Werkzeug-0.12.2 click-6.7 itsdangerous-0.24

MikedeMacBook-Pro:Downloads mike_lee$ 

MikedeMacBook-Pro:Downloads mike_lee$
sudo pip install flask_login

The directory '/Users/mike_lee/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want
sudo's -H flag.

The directory '/Users/mike_lee/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's
-H flag.

Collecting flask_login

  Downloading Flask_Login-0.4.0-py2.py3-none-any.whl

Requirement already satisfied: Flask in /Library/Python/2.7/site-packages (from flask_login)

Requirement already satisfied: itsdangerous>=0.21 in /Library/Python/2.7/site-packages (from Flask->flask_login)

Requirement already satisfied: Werkzeug>=0.7 in /Library/Python/2.7/site-packages (from Flask->flask_login)

Requirement already satisfied: Jinja2>=2.4 in /Library/Python/2.7/site-packages (from Flask->flask_login)

Requirement already satisfied: click>=2.0 in /Library/Python/2.7/site-packages (from Flask->flask_login)

Requirement already satisfied: MarkupSafe>=0.23 in /Library/Python/2.7/site-packages (from Jinja2>=2.4->Flask->flask_login)

Installing collected packages: flask-login

Successfully installed flask-login-0.4.0

MikedeMacBook-Pro:Downloads mike_lee$ 

卸载可使用命令:pip uninstall pyserial

查看可用命令:pip list

MikedeMacBook-Pro:Downloads mike_lee$ pip list

DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.

altgraph (0.10.2)

bdist-mpkg (0.5.0)

bonjour-py (0.3)

click (6.7)

Flask (0.12.2)

Flask-Login (0.4.0)

itsdangerous (0.24)

Jinja2 (2.9.6)

macholib (1.5.1)

MarkupSafe (1.0)

matplotlib (1.3.1)

modulegraph (0.10.4)

numpy (1.8.0rc1)

pip (9.0.1)

psutil (5.2.2)

py2app (0.7.3)

pyobjc-core (2.5.1)

pyobjc-framework-Accounts (2.5.1)

pyobjc-framework-AddressBook (2.5.1)
……

……
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: