“Import Statistics” Fails To Run

冷暖自知 提交于 2021-01-28 09:26:33

问题


When I use IDLE the code "import statistics" runs, however when I use sublimetext while other packages, such as matplotlib, can be imported I cannot import the statistics module. It gives me this error code:

import math
import matplotlib
import statistics

I expect nothing to happen on the screen, but in the command line it spits out. Note that the first two lines of code did work.

 ImportError: No module named statistics
[Finished in 1.2s with exit code 1]
[shell_cmd: python -u "/Users/Ivan/Desktop/Math file.py"]
[dir: /Users/Ivan/Desktop]
[path:     /opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin]

回答1:


Go to the command prompt.

Type

pip3 install update

If that doesn't work try

pip3 install --upgrade pip

Then type

pip3 install statistics

at the command prompt.

This has solved my similar problems in the past :)



来源:https://stackoverflow.com/questions/53965561/import-statistics-fails-to-run

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!