installieren Sie python2.7.3 + numpy + scipy + matplotlib + scikits.statsmodels + pandas0. 7. 3 korrekt
...unter Linux (xubuntu). So installieren Sie python2.7.3 + numpy + scipy + matplotlib + Scikits.statsmodels + pandas0.7. 3 richtig ? Mein letztes Ziel ist es, sie arbeiten zu lassen. Das problem:
~$ python --version
Python 2.7.3
Also habe ich bereits einen Systemstandard 2.7.3, was gut ist!
~$ dpkg -s python-numpy
Package: python-numpy
Status: install ok installed
Und ich habe bereits numpy installiert! Großartig! Aber...
~$ python
Python 2.7.3 (default, Oct 23 2012, 01:07:38)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as nmp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
Dieses Modul konnte von Python nicht gefunden werden. Das gleiche gilt für Scipy, Matplotlib. Warum?
~$ sudo apt-get install python-numpy
[...]
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-numpy is already the newest version.
[...]
Warum es numpy nicht sieht und andere ?
Aktualisieren:
>>> import sys
>>> print sys.path
['', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages']
>>>
Also habe ich /usr/local/lib / python2. 7
~$ pip freeze
Warning: cannot find svn location for distribute==0.6.16dev-r0
BzrTools==2.4.0
CDApplet==1.0
[...]
matplotlib==1.0.1
mutagen==1.19
numpy==1.5.1
[...]
pandas==0.7.3
papyon==0.5.5
[...]
pytz==2012g
pyxdg==0.19
reportlab==2.5
scikits.statsmodels==0.3.1
scipy==0.11.0
[...]
zope.interface==3.6.1
Wie Sie sehen, sind diese Module bereits installiert! Aber! ls -la /usr/local/lib/ gibt NUR python2.7 dir. Und immer noch
~$ python -V
Python 2.7.3
Und
Sys importieren sys.Version '2.7.3 (default, Oct 23 2012, 01:07:38) \n[GCC 4.6.1]'
Aktualisiert:
Wahrscheinlich habe ich eine andere Instanz verpasst... Einer bei /usr/Python-2.7.3/
und der zweite (scheint vor langer Zeit "von Hand" installiert zu sein) bei /usr/python2.7.3/Python-2.7.3/
Aber wie können zwei identische Versionen gleichzeitig funktionieren??? Wahrscheinlich ist einer von ihnen "deaktiviert" (wird von keinem Programm verwendet, aber ich weiß nicht, wie ich überprüfen soll, ob ein Programm es verwendet).
~$ ls -la /usr/bin/python*
lrwxrwxrwx 1 root root 9 2011-11-01 11:11 /usr/bin/python -> python2.7
-rwxr-xr-x 1 root root 2476800 2012-09-28 19:48 /usr/bin/python2.6
-rwxr-xr-x 1 root root 1452 2012-09-28 19:45 /usr/bin/python2.6-config
-rwxr-xr-x 1 root root 2586060 2012-07-21 01:42 /usr/bin/python2.7
-rwxr-xr-x 1 root root 1652 2012-07-21 01:40 /usr/bin/python2.7-config
lrwxrwxrwx 1 root root 9 2011-10-05 23:53 /usr/bin/python3 -> python3.2
lrwxrwxrwx 1 root root 11 2011-09-06 02:04 /usr/bin/python3.2 -> python3.2mu
-rwxr-xr-x 1 root root 2852896 2011-09-06 02:04 /usr/bin/python3.2mu
lrwxrwxrwx 1 root root 16 2011-10-08 19:50 /usr/bin/python-config -> python2.7-config
Es gibt einen Symlink python - >python2. 7, vielleicht kann ich diesen Link zum exakten /usr/Python-2.7.3/Python-Ziel ohne Schaden ln -f -s
?? Und wie richtig die 'Kopie' von 2.7.3 zu entfernen?
Und sonst...
~$ ls -la /usr/bin/virtualenv
-rwxr-xr-x 1 root root 58 2011-03-16 18:55 /usr/bin/virtualenv
Aber funktioniert nur in diesem Fall:
~$ /usr/bin/python /usr/bin/virtualenv qenv
New python executable in qenv/bin/python
Installing distribute....................................................................................................................................................................................done.
Installing pip...............done.
Und das funktioniert nicht!
python virtualenv.py pyenv
Ich werde versuchen, klarer zu sein. Nur Fragen. Warum kann ich numpy ab '/usr/bin/python' importieren, aber nicht nur mit 'python'? Wenn ich eine andere Version von Python für verschiedene Anwendungen installieren möchte, wie geht das am besten? Wie installiere ich Pakete in den gewählten Pythonpath? Ich habe keine vollständige Anleitung gefunden.
Vielen Dank an alle! Löste es so:
$ sudo nano /usr/share/python/debian_defaults
$ sudo mv /usr/bin/python /usr/bin/python2.Y_old
$ sudo ln -s -f /usr/bin/python2.7 /usr/bin/python
Meine standardversion war 2.7.3 und jetzt ist es 2.7.2+. Ich sehe keinen großen Unterschied, also denke ich, es war ziemlich sicher. Aber ich muss mehr über
Virtualenv
Und
Pip und Standard - WEG
3 answers
Ich empfehle Ihnen dringend, virtualenv zu verwenden. Virtualenv können Sie Python-Umgebung in pro Projektbasis erstellen. Mein Workflow zum Starten eines neuen Projekts ist
- Erstellen Sie das Projektverzeichnis
myapp
- virtualenv von herunterladen https://github.com/pypa/virtualenv/tarball/develop
- Erstellen Sie eine virtuelle Umgebung:
python virtualenv.py pyenv
- Aktiviere den virtualenv
source pyenv/bin/activate
-
Installieren Sie die Pakete in der virtuellen Umgebung:
pip install -U numpy matplotlib pandas ...
Mit diesem Setup können Sie die Version steuern, die Pakete neu installieren oder entfernen, ohne sich auf die Version verlassen zu müssen, die in den Repositorys verfügbar ist.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2012-10-25 13:19:17
Dies wird wahrscheinlich besser in einem Xubuntu-Forum gefragt, da es höchstwahrscheinlich ein Konfigurationsproblem ist. Ist es vielleicht mehr als eine version von python installiert?
Geben Sie im Python-Interpreter den folgenden Code ein;
import sys
print sys.path
Überprüfen Sie, ob das numpy-Verzeichnis in einem der in sys.path
aufgeführten Verzeichnisse installiert ist.
Auf meinem FreeBSD (UNIX-ähnlichen) System mit Python 2.7.3 ist numpy als Unterverzeichnis von /usr/local/lib/python2.7/site-packages/
installiert. Auf windows ist es wahrscheinlich C:\Python27\Lib\site-packages\
.
Wenn Sie zB habe auch einen Python 3.x installiert, könnte es sein, dass numpy et cetera für diesen Python installiert ist. In diesem Fall schauen Sie in /usr/local/lib/python3.x/site-packages/
oder C:\Python3x\Lib\site-packages\
.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2012-10-24 17:03:52
Sie scheinen ein benutzerdefiniertes Python 2.7.3 in /usr/local/bin
zu verwenden. Mit /usr/bin/python
sollten Sie in der Lage sein import numpy
; apt-get
installs to /usr
but never /usr/local
.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2012-10-24 20:34:37