python 2.7 OSX 10.10 软件包问题



我正在使用:Mac OSX 10.10.1

昨天我开始使用通常使用的相同软件包时出现错误。几个小时后,我决定从我的Mac中删除python

我按照以下说明再次安装了python:http://docs.python-guide.org/en/latest/starting/install/osx/#install-osx(我使用HomeBrew安装了python 2.7)

from the shell:
$python
Python 2.7.8 (default, Oct 19 2014, 16:02:00) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
from the shell:
$ which python
/usr/local/bin/python
from the shell:
$ which -a python
/usr/local/bin/python
/usr/local/bin/python

我安装了点子我使用 $ pip 安装命令安装了几个 pkgs

当我尝试只导入 openpyxl 时我得到这个:

import openpyxl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/openpyxl/__init__.py", line 27, in <module>
from openpyxl.workbook import Workbook
File "/usr/local/lib/python2.7/site-packages/openpyxl/workbook/__init__.py", line 25, in <module>
from .workbook import *
File "/usr/local/lib/python2.7/site-packages/openpyxl/workbook/workbook.py", line 11, in <module>
import threading
File   
"/usr/local/Cellar/python/2.7.8_2/Frameworks/
Python.framework/Versions/2.7/lib/python2.7/threading.py", 
line 14, in <module>
from time import time as _time, sleep as _sleep
ImportError: cannot import name time

你能帮帮我吗?谢谢d

附加信息:

同时我尝试做同样的事情来解决问题(我没有修复它)

基本上我安装了虚拟环境我创建了一个基本的虚拟环境我有一个包含 python 和所有 pkg 的新文件夹

(venv_002)danielepemys-MacBook-Pro:my_python_virtualenv danielepemy$ which python
/Users/danielepemy/my_python_virtualenv/venv_002/bin/python

一切看起来都很好,Python工作,pip工作PKG在虚拟环境中列出

(venv_002)danielepemys-MacBook-Pro:my_python_virtualenv danielepemy$ pip list
pip (1.5.6)
setuptools (3.6)
wsgiref (0.1.2)
XlsxWriter (0.6.4)

when I run a simple test script with XlsxWriter I get:
python ..//internet_speed_test_002.py 
Traceback (most recent call last):
  File "..//internet_speed_test_002.py", line 28, in <module>
    excel_file.close()
  File "/Users/danielepemy/my_python_virtualenv/venv_002/lib/python2.7/site-packages/xlsxwriter/workbook.py", line 286, in close
    self._store_workbook()
  File "/Users/danielepemy/my_python_virtualenv/venv_002/lib/python2.7/site-packages/xlsxwriter/workbook.py", line 509, in _store_workbook
    xml_files = packager._create_package()
  File "/Users/danielepemy/my_python_virtualenv/venv_002/lib/python2.7/site-packages/xlsxwriter/packager.py", line 142, in _create_package
    self._write_core_file()
  File "/Users/danielepemy/my_python_virtualenv/venv_002/lib/python2.7/site-packages/xlsxwriter/packager.py", line 325, in _write_core_file
    core._assemble_xml_file()
  File "/Users/danielepemy/my_python_virtualenv/venv_002/lib/python2.7/site-packages/xlsxwriter/core.py", line 57, in _assemble_xml_file
    self._write_dcterms_created()
  File "/Users/danielepemy/my_python_virtualenv/venv_002/lib/python2.7/site-packages/xlsxwriter/core.py", line 122, in _write_dcterms_created
    date = self._localtime_to_iso8601_date(date)
  File "/Users/danielepemy/my_python_virtualenv/venv_002/lib/python2.7/site-packages/xlsxwriter/core.py", line 76, in _localtime_to_iso8601_date
    return date.strftime("%Y-%m-%dT%H:%M:%SZ")

AttributeError: 'module' object has no attribute 'struct_time'

当前目录中是否有名为 time.pytime.pyc 的文件?如果是这样,请重命名或删除它们(.pyc文件可以简单地删除)。

最新更新