3

I'm using Ubuntu 14.04.

I manually installed Python 2.7.9 with this file.

But now, site.getsitepackages() method shows like bellow. And I can't import any installed modules.

>>> import site; site.getsitepackages()
['/usr/local/lib/python2.7/site-packages', '/usr/local/lib/site-python']

The sub-directories must be named "dist-packages" on Ubuntu instead of "site-packages". How can I fix this?

fx-kirin
  • 1,906
  • 1
  • 20
  • 33

2 Answers2

4

A quick solution would be to rename the directories or create a symbolic link:

$ ln -s /usr/local/lib/python2.7/site-packages /usr/local/lib/python2.7/dist-packages
Malik Brahimi
  • 16,341
  • 7
  • 39
  • 70
  • And a lot less headaches. – Nodak Feb 13 '15 at 13:36
  • I noticed that was not enogh to solve the problem. In that case, a conflict error will occur like "undefined symbol: PyUnicodeUCS4_FromWideChar". It happens because the Python I run with is not the same Python I built with, and they have different unicode build settings. – fx-kirin Feb 15 '15 at 11:57
1

if you installed setuptools and pip through apt-get, sitepackages will be installed to the dist-packages directory(see this answer).

In this case, the build-in Python and the manually installed Python can have different unicode build settings.

To avoid this conflict problem, I must install setuptools manually through the manually installed Python. Don't use apt-get to install anything related to the Ubuntu build-in Python.

Community
  • 1
  • 1
fx-kirin
  • 1,906
  • 1
  • 20
  • 33