1
我想在我的Mac上使用Orange3,但出現此錯誤:ImportError: cannot import name '_variable'
。orange3:ImportError:無法導入名稱'_variable'
這是我的設置:
$ cd orange_playground
$ virtualenv -p python3 venv
$ pip install orange3
$ source venv/bin/activate
$ python
輸出如下:從orange_playground/venv/lib/python3.4/site-packages/Orange/data/variable.py
的代碼
Python 3.4.2 (default, Oct 8 2014, 19:29:52)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.51)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Orange
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "orange_playground/venv/lib/python3.4/site-packages/Orange/__init__.py", line 11, in <module>
from .misc.lazy_module import _LazyModule
File "orange_playground/venv/lib/python3.4/site-packages/Orange/misc/__init__.py", line 3, in <module>
from .distmatrix import DistMatrix
File "orange_playground/venv/lib/python3.4/site-packages/Orange/misc/distmatrix.py", line 3, in <module>
from Orange.data import Table, StringVariable, Domain
File "orange_playground/venv/lib/python3.4/site-packages/Orange/data/__init__.py", line 4, in <module>
from .variable import *
File "orange_playground/venv/lib/python3.4/site-packages/Orange/data/variable.py", line 11, in <module>
from Orange.data import _variable
ImportError: cannot import name '_variable'
第一線:
import collections
import re
from datetime import datetime, timedelta, timezone
from numbers import Number, Real, Integral
from math import isnan, floor
from pickle import PickleError
import numpy as np
from Orange.data import _variable
from Orange.util import Registry, color_to_hex, hex_to_color
__all__ = ["Unknown", "MISSING_VALUES", "make_variable", "is_discrete_values",
"Value", "Variable", "ContinuousVariable", "DiscreteVariable",
"StringVariable", "TimeVariable"]
# For storing unknowns
Unknown = ValueUnknown = float("nan")
# For checking for unknowns
MISSING_VALUES = {np.nan, "?", "nan", ".", "", "NA", "~", None}
...
任何想法怎麼辦?
'_variable'是爲了[編譯模塊](https://github.com/biolab/orange3/blob/master/Orange/data/_variable.pyx)。你是如何安裝的? –
'pip在'venv'的Mac上安裝orange3'。 – ddofborg
有沒有錯誤輸出?你有['cython'安裝](http://cython.readthedocs.io/en/latest/src/quickstart/install.html)?你有安裝XCode([檢查命令行工具是否安裝](http://stackoverflow.com/questions/15371925/how-to-check-if-command-line-tools-is-installed))? –