我刚刚安装了 Python 3.5.2。我在 shell/IDLE 环境中工作并尝试导入 Pandas。
但是当我写:import pandas
我得到以下信息:
Traceback (most recent call last):
File "C:/Users/bartogre/Desktop/Program1.py", line 1, in <module>
import pandas
ImportError: No module named 'pandas'
如何将任何模块添加到 Python 3.5.2 正在读取的库中?我不想在 Anaconda 中工作。
我看了这个视频:https://www.youtube.com/watch?v=ddpYVA-7wq4
下面是我的 CMD 输出:
C:\Users\bartogre>
C:\Users\bartogre>cd c:\users\bartogre\desktop\pyodbc-master
c:\Users\bartogre\Desktop\pyodbc-master>python setup.py
c:\Users\bartogre\Desktop\pyodbc-master>python setup.py install
'git' is not recognized as an internal or external command,
operable program or batch file.
WARNING: git describe failed with: 1
WARNING: Unable to determine version. Using 3.0.0.0
C:\Program Files (x86)\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.5.egg\s
etuptools\dist.py:340: UserWarning: The version specified ('3.0.0-unsupported')
is an invalid version, this may not work as expected with newer versions of setu
ptools, pip, and PyPI. Please see PEP 440 for more details.
running install
running bdist_egg
running egg_info
writing pyodbc.egg-info\PKG-INFO
writing dependency_links to pyodbc.egg-info\dependency_links.txt
writing top-level names to pyodbc.egg-info\top_level.txt
reading manifest file 'pyodbc.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pyodbc.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_ext
building 'pyodbc' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++
Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
请您参考如下方法:
背景知识:一个系统可以安装多个 Python。在 Windows 上,每个目录都是一个包含 python.exe 和 Lib/site-packages/的目录。要使用带有特定 python.exe 的包,您必须安装到相应的站点包中。
在您的例子中,“python”调用“C:\Program Files (x86)\Anaconda3\python.exe”。您是否有另一个要使用的 python 安装?
无论如何,当前在 Windows 上安装包的标准方法是使用 pip。在控制台中运行它的最佳方式是
some/path> <some python> -m pip install package
哪里<some python>是 python调用默认安装或其他东西来获得另一个安装。 pip首先去pypi.python.org找包。如果包中包含 C 代码,它可能会找到合适的预构建二进制文件或尝试在本地编译,这需要正确版本的 Visual C++ 编译器。
如果 pip 没有为您的安装找到预构建的二进制文件,我将执行以下操作。对于大约 200 个软件包,非官方二进制文件可在 http://www.lfd.uci.edu/~gohlke/pythonlibs/ 获得。 .该站点已经运行了至少十年,并且是 Windows 用户的救命稻草,我和许多其他人都使用过它。 Cristoph 提供了有关如何下载文件然后使用 pip 进行安装的说明。
