2017-05-20 4 views
0

Ich brauche ein Spacepy-Paket. Ich habe es sorgfältig nach these Anweisungen ohne besonderes Problem installiert. Am Ende der Installation tat ich:Berechtigung verweigert Modulimport mit Spacepy

python 
>>> import spacepy 

Und es funktionierte gut. Später habe ich versucht, ein Skript auszuführen, das spacepy verwendet und ich habe einen Importfehler mit diesem Paket bekommen. Dann habe ich:

python 
>>> import spacepy 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "spacepy/__init__.py", line 329, in <module> 
    _read_config(rcfile) 
    File "spacepy/__init__.py", line 297, in _read_config 
    _write_defaults(rcfile, defaults) 
    File "spacepy/__init__.py", line 200, in _write_defaults 
    f = open(rcfile, 'r+t') #Avoid race condition, open for read and write 
IOError: [Errno 13] Permission denied: '/home/arnaud/.spacepy/spacepy.rc' 
>>> 

Ich habe versucht:

cd ~/.spacepy 
chmod +rwx spacepy.rc 

Aber es hat nichts ändern. Ich habe auch versucht Python mit sudo zu laufen, und es funktioniert nicht so gut funktionieren, obwohl ich einen anderen Fehler haben:

sudo python 
>>> import spacepy 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/usr/local/lib/python2.7/dist-packages/spacepy/__init__.py", line 131, in <module> 
    from . import datamodel 
    File "/usr/local/lib/python2.7/dist-packages/spacepy/datamodel.py", line 178, in <module> 
    from . import toolbox 
    File "/usr/local/lib/python2.7/dist-packages/spacepy/toolbox/__init__.py", line 48, in <module> 
    from spacepy import time as spt 
    File "/usr/local/lib/python2.7/dist-packages/spacepy/time.py", line 101, in <module> 
    import dateutil.parser as dup 
ImportError: No module named dateutil.parser 

Darüber hinaus, wenn Python mit sudo ausgeführt wird, kann ich nicht alle anderen Pakete laden (numpy, scipy, etc ...). Ich habe Python 2.7 mit Anaconda installiert.

Wissen Sie etwas, was ich versuchen könnte?

Ich habe das gleiche Verfahren auf einem anderen Computer und es funktionierte ohne Probleme.

Antwort

0

Ich fand es heraus. Ändern spacepy.rc Dateiberechtigungen war zwar die gute Lösung, aber ich habe es nicht für alle Benutzer mit "a" -Flag angewendet. Doing:

cd ~/.spacepy 
chmod a+rwx spacepy.rc 

wurde das Problem behoben