sys.path in python3.3

Ned Deily nad at acm.org
Sun Aug 26 19:18:40 EDT 2012


In article 
<CAAu18hducpKutb49s_8KXD-16GamACF+E0TT1+=h5rrh+J55FQ at mail.gmail.com>,
 Nicholas Cole <nicholas.cole at gmail.com> wrote:
> It certainly does exist. Distutils will happily put packages into it,
> but import won't find them.

That's odd!  It works for me on 10.8 and it worked for me yesterday on 
10.7 which I tested just after completing the python.org installer 
builds.  Perhaps there is some permission issue.  Or the path name isn't 
quite correct.  Or you have some PYTHON* environment variable set, like 
PYTHONNOUSERSITE?

Here's a simple case I just tried installing Distribute using --user:

$ ls -ld Library/
drwx------@ 59 nad  staff  2074 Aug 26 15:03 Library//
$ ls -ld Library/Python/
drwxr-x---  5 nad  staff  170 Aug 25 14:37 Library/Python//
$ ls -ld Library/Python/3.3
drwx------  4 nad  staff  136 Aug 25 14:37 Library/Python/3.3/
$ ls -ld Library/Python/3.3/lib/
drwx------  3 nad  staff  102 Aug 25 14:37 Library/Python/3.3/lib//
$ ls -ld Library/Python/3.3/lib/python/
drwx------  3 nad  staff  102 Aug 25 14:37 
Library/Python/3.3/lib/python//
$ ls -ld Library/Python/3.3/lib/python/site-packages/
drwx------  6 nad  staff  374 Aug 25 14:37 
Library/Python/3.3/lib/python/site-packages//
$ mv Library/Python/ Library/PythonDis
$ /usr/local/bin/python3.3
Python 3.3.0rc1 (v3.3.0rc1:8bb5c7bc46ba, Aug 25 2012, 10:09:29) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> pp(sys.path)
['',
 '/Library/Frameworks/Python.framework/Versions/3.3/lib/python33.zip',
 '/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3',
 
'/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/plat-dar
win',
 
'/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/lib-dynl
oad',
 
'/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-pac
kages']
>>> ^D
$ curl -O http://python-distribute.org/distribute_setup.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  
Current
                                 Dload  Upload   Total   Spent    Left  
Speed
100 16295  100 16295    0     0  18199      0 --:--:-- --:--:-- --:--:-- 
31518
$ /usr/local/bin/python3.3 distribute_setup.py --user
Downloading 
http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar
.gz
Extracting in /var/folders/fm/9wjgctqx61n796zt88qmmnxc0000gn/T/tmp25bmgw
Now working in 
/var/folders/fm/9wjgctqx61n796zt88qmmnxc0000gn/T/tmp25bmgw/distribute-0.6
.28
Installing Distribute
[...]
creating dist
creating 'dist/distribute-0.6.28-py3.3.egg' and adding 
'build/bdist.macosx-10.6-intel/egg' to it
removing 'build/bdist.macosx-10.6-intel/egg' (and everything under it)
Processing distribute-0.6.28-py3.3.egg
creating 
/Users/nad/Library/Python/3.3/lib/python/site-packages/distribute-0.6.28-
py3.3.egg
Extracting distribute-0.6.28-py3.3.egg to 
/Users/nad/Library/Python/3.3/lib/python/site-packages
Adding distribute 0.6.28 to easy-install.pth file
Installing easy_install-3.3 script to /Users/nad/Library/Python/3.3/bin
Installing easy_install script to /Users/nad/Library/Python/3.3/bin

Installed 
/Users/nad/Library/Python/3.3/lib/python/site-packages/distribute-0.6.28-
py3.3.egg
Processing dependencies for distribute==0.6.28
Finished processing dependencies for distribute==0.6.28
After install bootstrap.
Don't have permissions to write 
/Users/nad/Library/Python/3.3/lib/python/site-packages/setuptools-0.6c11-
py3.3.egg-info, skipping
Creating 
/Users/nad/Library/Python/3.3/lib/python/site-packages/setuptools-0.6c11-
py3.3.egg-info
Creating 
/Users/nad/Library/Python/3.3/lib/python/site-packages/setuptools.pth
$ ls Library/Py
Python/    PythonDis/ 
$ ls Library/Python/3.3/
bin/ lib/ 
$ ls Library/Python/3.3/lib/python/site-packages/
distribute-0.6.28-py3.3.egg/      setuptools-0.6c11-py3.3.egg-info
easy-install.pth                  setuptools.pth
$ ls Library/Python/3.3/lib/python/site-packages/
distribute-0.6.28-py3.3.egg/      setuptools-0.6c11-py3.3.egg-info
easy-install.pth                  setuptools.pth
$ /usr/local/bin/python3.3
Python 3.3.0rc1 (v3.3.0rc1:8bb5c7bc46ba, Aug 25 2012, 10:09:29) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> pp(sys.path)
['',
 
'/Users/nad/Library/Python/3.3/lib/python/site-packages/distribute-0.6.28
-py3.3.egg',
 '/Library/Frameworks/Python.framework/Versions/3.3/lib/python33.zip',
 '/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3',
 
'/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/plat-dar
win',
 
'/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/lib-dynl
oad',
 '/Users/nad/Library/Python/3.3/lib/python/site-packages',
 
'/Users/nad/Library/Python/3.3/lib/python/site-packages/setuptools-0.6c11
-py3.3.egg-info',
 
'/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-pac
kages']
>>> import setuptools
>>> setuptools.__file__
'/Users/nad/Library/Python/3.3/lib/python/site-packages/distribute-0.6.28
-py3.3.egg/setuptools/__init__.py'

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list