0

So, I want to start using Python 3.4.1. I've got it installed on my machine, etc, and it'll print("hello world!") and according to this post, which seems sensible, I need to leave 2.7 in place for backwards compatibility: how to change default python version?

OK great, now, what's the best way to make Python 3 "see" all my great modules I've got installed for 2.7? All my old buddies like Pandas and XLRD are like "No module named Pandas."

And yes, all my libraries are in

Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

I suspect a lot of reinstallation in my future …

Community
  • 1
  • 1
Maggie
  • 1,975
  • 3
  • 15
  • 17

1 Answers1

3

You'll have to re-install those modules for Python 3.4.1.

You could try and reuse the site-packages directory, but chances are that a lot of the packages will simply fail.

  • Python packages with C extensions will need recompiling.
  • Any package that uses the 2to3 utility to create a Python 3 version on install will not have had that utility applied in the 2.7 installation and won't work in Python 3.
  • Any package that uses the 3to2 utility to create a Python 2 version on install will have had that utility applied to the 2.7 installation and won't work in Python 3.
  • Some packages are not Python 3 compatible, full stop. They may have had new releases in the meantime that are compatible.

If you used pip to install those packages you can use pip freeze to get a list of what you have installed now. You can then install those on Python 3 with:

pip freeze > installed-2.7.txt
python3 -m pip install -f installed-2.7.txt

and hope for the best.

Vivek Sable
  • 9,938
  • 3
  • 40
  • 56
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343