简体   繁体   中英

How to install pandas with pip3 for Python3

I'm trying to install pandas for Python3. I ran the following command

pip3 install --user pandas

This worked perfectly with numpy instead of pandas .

And for pandas I obtain the following error that I don't know how to debug

Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-1ac09uln/pandas/setup.py", line 42
       f"numpy >= {min_numpy_ver}",
                              ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-1ac09uln/pandas/

It seems that there is a syntax error in the pandas setup file... Since the problematic line is the one dealing with the minimum numpy version I checked which version I had, and it's the 1.18.2 (latest). What should I do now?

What version of python you have installed?Is pip updated to the latest version. f-strings where introduced in python 3.6. Maybe this is the problem. In any case it should be easier to install all packages you want using an environment like anaconda so that you can have all packages needed from the start(eg all packages needed for data science). For an alternative you can try run pip using a specific python version(try 3.6 or greater) you can find more info for this here: Install a module using pip for specific python version .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM