在试图使用panda包进行数据分析时,发现导入包失败,通过以下方法尝试后解决
报错代码:
PS D:DEMOMathorCup est> python py.py Traceback (most recent call last): File "py.py", line 1, in <module> import pandas as pd ModuleNotFoundError: No module named 'pandas'
使用cmd输入 以下命令
pip install pandas -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
弹出错误
Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'c:\program files\python\lib\site-packages\pip-10.0.1.dist-info\entry_points.txt' Consider using the
--user option or check the permissions.
命令最后加上 --user
pip install pandas -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com --user
安装成功
Successfully installed numpy-1.19.5 pandas-1.1.5 python-dateutil-2.8.1 pytz-2020.5 You are using pip version 10.0.1, however version 20.3.3 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.