Reputation: 1339
I need to have different versions of pandas to be able to import either 0.13 or 0.14 version. I gone in the path "C:\Python27\Lib\site-packages" and changing the directory name of pandas to pandas_013 but I get the following error.
Has someone a solution to have multi version library with python 2.7?
>>> import pandas_013
No module named pandas.compat
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\pandas_013\__init__.py", line 6, in <module>
from . import hashtable, tslib, lib
File "tslib.pyx", line 37, in init pandas.tslib (pandas\tslib.c:55034)
ImportError: No module named pandas.compat
Upvotes: 0
Views: 208
Reputation: 14834
If you want to use multiple versions, they should be inside your package, probably in a lib
package. So then you have mypackage.lib.pandas_013
and mypackage.lib.pandas_014
. Next, you need to fix those libraries - remember that they will be filled with imports like the one which errored for you (pandas.compat
). So that needs to be changed to mypackage.lib.pandas_013.compat
and mypackage.lib.pandas_014.compat
, as does every other reference to the original pandas
package. An IDE with refactoring or some sed-fu can help here.
Upvotes: 1