命令行更新python的pip包 && 用pip或pycharm图形界面安装python外部库

pycharm安装可以选择安装位置,可以不装在python安装路径下,下图左下角可以选择路径
命令行直接pip默认装在python的安装文件夹里的lib路径下,如

C:\Users\xxxx\AppData\Local\Programs\Python\Python36\Lib\site-packages
  1. pycharm安装遗传算法库geatpy,比matlab的遗传工具箱性能好得多,版本一直有学生团队维护和更新,放在GitHub的,安装和入门教程见官网
    命令行更新python的pip包 && 用pip或pycharm图形界面安装python外部库_第1张图片
    在控制台输入下列命令查看版本:
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
import geatpy as ea
print(ea.__version__)
2.2.1
  1. 命令行更新pip,可以看到旧版本和安装的新版本

C:\Users\SSMM>python -m pip install  --upgrade pip
Collecting pip
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(, 'Connection to files.pythonhosted.org timed out. (connect timeout=15)')': /packages/62/ca/94d32a6516ed197a491d17d46595ce58a83cbb2fca280414e57cd86b84dc/pip-19.2.1-py2.py3-none-any.whl
  Downloading https://files.pythonhosted.org/packages/62/ca/94d32a6516ed197a491d17d46595ce58a83cbb2fca280414e57cd86b84dc/pip-19.2.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 317kB/s
Installing collected packages: pip
  Found existing installation: pip 19.0.3
    Uninstalling pip-19.0.3:
      Successfully uninstalled pip-19.0.3
Successfully installed pip-19.2.1
  1. 然后尝试安装python外部库,由于numpy和matplotlib我在pycharm里面装了,系统就检测到已经有了,需要其他库可以通过命令行直接用pip装,也可以在Pycharm装

C:\Users\SSMM>pip install numpy
Requirement already satisfied: numpy in c:\users\ssmm\appdata\roaming\python\python37\site-packages (1.17.0)

C:\Users\SSMM>pip install matplotlib
Requirement already satisfied: matplotlib in d:\users\ssmm\appdata\local\programs\python\python37\lib\site-packages (3.1.1)
Requirement already satisfied: numpy>=1.11 in c:\users\ssmm\appdata\roaming\python\python37\site-packages (from matplotlib) (1.17.0)
Requirement already satisfied: cycler>=0.10 in d:\users\ssmm\appdata\local\programs\python\python37\lib\site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: python-dateutil>=2.1 in d:\users\ssmm\appdata\local\programs\python\python37\lib\site-packages (from matplotlib) (2.8.0)
Requirement already satisfied: kiwisolver>=1.0.1 in d:\users\ssmm\appdata\local\programs\python\python37\lib\site-packages (from matplotlib) (1.1.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in d:\users\ssmm\appdata\local\programs\python\python37\lib\site-packages (from matplotlib) (2.4.2)
Requirement already satisfied: six in c:\users\ssmm\appdata\roaming\python\python37\site-packages (from cycler>=0.10->matplotlib) (1.12.0)
Requirement already satisfied: setuptools in d:\users\ssmm\appdata\local\programs\python\python37\lib\site-packages (from kiwisolver>=1.0.1->matplotlib) (40.8.0)

你可能感兴趣的:(Python,python)