简体   繁体   中英

Problems with Python package installation, versioning

I am using Python 2.7.4. Works fine for web development and everything that doesn't require the use of specific packages.

But every time I am trying to install and use a new package, I get an error.

Example:

Cloned https://github.com/fatiherikli/worldcup

install worldcup was successful (python-dateutil, colorama, pytz, humanize)

But

$ worldcup today    
Traceback (most recent call last):    
  File "/usr/local/bin/worldcup", line 8, in <module>    
    load_entry_point('worldcup==1.0.3', 'console_scripts', 'worldcup')()    
  File "/Library/Python/2.6/site-packages/worldcup.py", line 129, in main    
    print prettify(match)    
  File "/Library/Python/2.6/site-packages/worldcup.py", line 45, in prettify
    seconds = diff.total_seconds()
AttributeError: 'datetime.timedelta' object has no attribute 'total_seconds'

My python version is 2.7 not 2.6:

$ python --version
Python 2.7.4

Any suggestion?

From the path names it appears you are running on a version of Mac OS X, which comes with multiple builtin versions of Python and you have likely installed a newer version of Python 2.7. Chances are you have installed a version of pip for your system Python 2.6 but not for the Python 2.7 that worldcup requires. You can easily check this by typing:

python2.7 -m pip install worldcup

If pip is not available for that instance of Python you'll need to install it by downloading get-pip.py and running it with python2.7 .

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