Import Pandas Into Python
A bit of background: a system can have multiple Python installations. On Windows, each is a directory with python.exe and Lib/site-packages/. To use a package with a particular python.exe, you must install into the corresponding site-packages.
In your case, 'python' invokes 'C:\Program Files (x86)\Anaconda3\python.exe'. Do you have another python installation that you want to be working with?
In any case, the current standard way to install packages on Windows is with pip. The best way to run it in the console is
some/path> <some python> -m pip install package
where <some python>
is either python
to invoke the default install or something else to get another install. Pip first goes to pypi.python.org to find the package. If the package contains C code, it may find an appropriate pre-built binary or try to compile locally, which requires the correct version of Visual C++ compiler.
If pip does not find a pre-built binary for your install, I would do the following. For about 200 packages, unofficial binaries are available at http://www.lfd.uci.edu/~gohlke/pythonlibs/. The site has been up for up, and a livesave for Windows users, for at least a decade and I and many others have used it. Cristoph gives instructions on how to download a file and then use pip to install it.
polonius11
Updated on June 04, 2022Comments
-
polonius11 almost 2 years
I just installed Python 3.5.2. I am working in the shell/IDLE environment and attempting to import Pandas.
However when I write: import pandas
I get the following:
Traceback (most recent call last): File "C:/Users/bartogre/Desktop/Program1.py", line 1, in <module> import pandas ImportError: No module named 'pandas'
How do I add any module to the library Python 3.5.2 is reading? I do not want to work in Anaconda.
I watched this video: https://www.youtube.com/watch?v=ddpYVA-7wq4
And below is my output from 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
-
polonius11 over 7 years@ Terry - I am trying to install the modules to Python 3.5 located here: C:\Users\bartogre\AppData\Local\Programs\Python\Python35-32\ What is PIP? A web search takes me to pypi.python.org/pypi/pip If I read your answer correctly I would need to.... 1) Install PIP 2) Run the command C:\Users\bartogre\AppData\Local\Programs\Python\Python35-32\> <python.exe> -m pip install pandas 3) Done?
-
Terry Jan Reedy over 7 yearspip = python installer program, or something like that. To solve the bootstrap problem -- how to install the installer, a version of pip is included with the PSF python.org installer. '-m pip' runs the installed pip package. So skip 1). Note that the installed pip can update itself. <python> -m pip -h will display general help message. pip install -h will display install-specific help. Try 2).
-
Terry Jan Reedy over 7 yearsIf 2) does not work because it cannot compile, use the alternative I outlined to get a compiled binary ready to install. pip installs 'wheels', denoted xyz.whl, I believe.