简体   繁体   English

Python软件包安装,版本控制问题

[英]Problems with Python package installation, versioning

I am using Python 2.7.4. 我正在使用Python 2.7.4。 Works fine for web development and everything that doesn't require the use of specific packages. 适用于Web开发以及不需要使用特定程序包的所有程序。

But every time I am trying to install and use a new package, I get an error. 但是每次我尝试安装和使用新软件包时,都会出现错误。

Example: 例:

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

install worldcup was successful (python-dateutil, colorama, pytz, humanize) install worldcup成功(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版本是2.7而不是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. 从路径名称看来,您正在运行Mac OS X版本,该版本随附多个内置Python版本,并且您可能已安装了更新版本的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. 您可能已经为系统Python 2.6安装了pip版本,但没有为worldcup所需的Python 2.7安装pip版本。 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 . 如果pip对于该Python实例不可用,则需要通过下载get-pip.py并使用python2.7运行它来安装它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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