1. 安装Python的符号计算模块 SymPy
Posted by haifeng on 2020-12-18 14:41:29 last update 2020-12-18 14:57:26 | 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