试图设置virtualenv给出错误'无法导入名称_remove_dead_weakref'安装vatic时

时间:2017-11-21 20:27:54

标签: python python-2.7 virtualenv

我试图安装vatic,一个要求就是运行“virtualenv .env'来自vatic工作区。当我运行它时,我得到〜/ anaconda2 / lib / python2.7 / weakref.py有一个错误'无法导入name_remove_dead_weakref。

virtualenv .env
New python executable in /home/tyler/vatic_ws/.env/bin/python
Installing setuptools, pip, wheel...
    Complete output from command /home/tyler/vatic_ws/.env/bin/python - setuptools pip wheel:
      Traceback (most recent call last):
      File "<stdin>", line 7, in <module>
      File "/home/tyler/anaconda2/lib/python2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/__init__.py", line 5, in <module>
      File "/home/tyler/anaconda2/lib/python2.7/logging/__init__.py", line 26, in <module>
        import sys, os, time, cStringIO, traceback, warnings, weakref, collections
      File "/home/tyler/anaconda2/lib/python2.7/weakref.py", line 14, in <module>
        from _weakref import (
    ImportError: cannot import name _remove_dead_weakref

但是当我尝试使用

运行我自己的python脚本时
from _weakref import _remove_dead_weakref

我没有收到错误。为什么我不能复制错误,我该如何解决?

1 个答案:

答案 0 :(得分:1)

Brandon Rhodes has solved this problem
描述的相关部分:

datetime

你需要运行他的脚本。我将在这里复制脚本,以防它消失。

ts = pd.Timestamp('2018-02-02 23:59:59+0000', tz='UTC')

ts.tz_convert(None)
# returns Timestamp('2018-02-02 23:59:59')

ts.tz_convert(None).to_pydatetime()
# returns datetime.datetime(2018, 2, 2, 23, 59, 59)