Answer

问题及解答

安装Python的符号计算模块 SymPy

Posted by haifeng on 2020-12-18 14:41:29 last update 2021-12-01 16:11:00 | Edit | Answers (0)

默认情况下, Python 并未安装 sympy

C:\Users\haife>python
Python 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sympy
Traceback (most recent call last):
  File "", line 1, in
ModuleNotFoundError: No module named 'sympy'

此时需要安装 sympy

C:\Users\haife>pip install sympy


Defaulting to user installation because normal site-packages is not writeable
Collecting sympy
  Downloading sympy-1.7.1-py3-none-any.whl (5.9 MB)
     |████████████████████████████████| 5.9 MB 16 kB/s
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/mpmath/
Collecting mpmath>=0.19
  Downloading mpmath-1.1.0.tar.gz (512 kB)
     |████████████████████████████████| 512 kB 18 kB/s
Using legacy 'setup.py install' for mpmath, since package 'wheel' is not installed.
Installing collected packages: mpmath, sympy
    Running setup.py install for mpmath ... done
  WARNING: The script isympy.exe is installed in 'C:\Users\haife\AppData\Roaming\Python\Python39\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed mpmath-1.1.0 sympy-1.7.1
WARNING: You are using pip version 20.2.3; however, version 20.3.3 is available.
You should consider upgrading via the 'c:\program files\python39\python.exe -m pip install --upgrade pip' command.


上面提示将 isympy.exe 所在目录 C:\Users\haife\AppData\Roaming\Python\Python39\Scripts 加入到环境变量 PATH 中.

顺便升级一下 pip

C:\Users\haife>python.exe -m pip install --upgrade pip


Defaulting to user installation because normal site-packages is not writeable
Collecting pip
  Downloading pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 17 kB/s
Installing collected packages: pip
  WARNING: The scripts pip.exe, pip3.9.exe and pip3.exe are installed in 'C:\Users\haife\AppData\Roaming\Python\Python39\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-20.3.3


 

 


Date: 2021-12-01

安装 Pandas

pip install Pandas
Defaulting to user installation because normal site-packages is not writeable
Collecting Pandas
  Downloading pandas-1.3.4-cp39-cp39-win_amd64.whl (10.2 MB)
     |████████████████████████████████| 10.2 MB 15 kB/s
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/numpy/
Collecting numpy>=1.17.3
  Downloading numpy-1.21.4-cp39-cp39-win_amd64.whl (14.0 MB)
     |████████████████████████████████| 14.0 MB 14 kB/s
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/python-dateutil/
Collecting python-dateutil>=2.7.3
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     |████████████████████████████████| 247 kB 16 kB/s
Collecting pytz>=2017.3
  Downloading pytz-2021.3-py2.py3-none-any.whl (503 kB)
     |████████████████████████████████| 503 kB 19 kB/s
Collecting six>=1.5
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: six, pytz, python-dateutil, numpy, Pandas
Successfully installed Pandas-1.3.4 numpy-1.21.4 python-dateutil-2.8.2 pytz-2021.3 six-1.16.0
WARNING: You are using pip version 21.0.1; however, version 21.3.1 is available.
You should consider upgrading via the 'c:\program files\python39\python.exe -m pip install --upgrade pip' command.


升级 pip

D:\work\cs\python\SankeyDiagram>python -m pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in c:\users\haife\appdata\roaming\python\python39\site-packages (21.0.1)
Collecting pip
  Downloading pip-21.3.1-py3-none-any.whl (1.7 MB)
     |████████████████████████████████| 1.7 MB 13 kB/s
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 21.0.1
    Uninstalling pip-21.0.1:
      Successfully uninstalled pip-21.0.1
Successfully installed pip-21.3.1


安装 pyecharts

D:\work\cs\python\SankeyDiagram>pip install pyecharts
Defaulting to user installation because normal site-packages is not writeable
Collecting pyecharts
  Downloading pyecharts-1.9.1-py3-none-any.whl (135 kB)
     |████████████████████████████████| 135 kB 23 kB/s
Collecting simplejson
  Downloading simplejson-3.17.6-cp39-cp39-win_amd64.whl (75 kB)
     |████████████████████████████████| 75 kB 18 kB/s
Collecting prettytable
  Downloading prettytable-2.4.0-py3-none-any.whl (24 kB)
Collecting jinja2
  Downloading Jinja2-3.0.3-py3-none-any.whl (133 kB)
     |████████████████████████████████| 133 kB 29 kB/s
Collecting MarkupSafe>=2.0
  Downloading MarkupSafe-2.0.1-cp39-cp39-win_amd64.whl (14 kB)
Collecting wcwidth
  Downloading wcwidth-0.2.5-py2.py3-none-any.whl (30 kB)
Installing collected packages: wcwidth, MarkupSafe, simplejson, prettytable, jinja2, pyecharts
Successfully installed MarkupSafe-2.0.1 jinja2-3.0.3 prettytable-2.4.0 pyecharts-1.9.1 simplejson-3.17.6 wcwidth-0.2.5