Installation und Konfiguration von Python auf Win 10 und auch auf MX-Linux 19.1 - Befunde und Fragen
Verfasst: Montag 23. März 2020, 22:32
Hallo und guten Abend
vorweg: bin sehr froh dass ihr ein Forum(Unterforum habt, das für dem Thema Installation und Konfiguration vorbehalten ist. Super Sache und wie für mich gemacht.
,,,, ich bin am Aufbau einer Entwicklungsumgebung für Python auf zwei Systemen:
Win 10: mit PyCharm, VsCode u. ATOM (Bürorechner)
MX-Linux: mit ATOM (@home)
Zwischenfazit: also noch läuft das etwas holprig - auf der Linux-Kiste ist die Frage ob ich denn
a. alle Python-Pakete schon richtig eingerichtet habe und ob
b. ich auch die richtigen Plugins von Atom verwende - ferner hätter ich auf der MX-Linux 19.1 gerne halt auch
c. VSCode, das ist im Mom aber nicht in den Repositories drinne - die Installation kann via Flatpack oder Codium oder noch auf einem dritten
Wege laufen.... Alles in Allem halt etwas doof - aber ATOM ist - wenn alles gut eingerichtet ist ja auch nicht übel hat v.a. auch eine nette Github-Integration.
Es kommen also sicher zu beiden Systeme - zum Aufbau auf Windows 10 und auch auf der MX-Linux-Kiste sicher noch ein paar Fragen in den kommenden Tagen.
Hier ein Mini-Befund den ich eben im Büro mache:
ist von hier - https://stackoverflow.com/questions/608 ... b-scraping
und dient zu einem Test meines Systems hier
Doch - wenn man mal schaut was ich vorhin noch auf den Rechner draufgepackt habe dann ist das folgendes
Soweit die aktuellen Fragen zur Win10 Kiste:
und zur Linux Kiste hier noch gleich die Frage: ich hab auf der MX-Linux 19.1 ein Python 3.7.3 soweit so gut.
pit ist noch nicht drauf.
Wenn ich dort z.B. pandas installieren will, dann läuft das nicht.
pip install pandas
Ich könnte, so glaube ich nun anfangs mal pip installieren.
ferner hab ich noch gelesen - dass man auch EasyBuild zu Installationszwecken verwenden könnte:
Note If we already have easybuild installed, we may need to instruct easy_install to install a newer version, using --upgrade or -U.
Aber es gilt offentsichtlich (dass man aufpassen muss):
Frage: Was aber ist davon zu halten:
Nun stellt sich für mich die Frage: wie kann ich hier installieren. Welche generellen Optionen habe ich.
- pandas oder andere Module mit oder ohne pip installieren.
- pip einfach mal installieren.
- eine einfache Methoder fürs generelle installieren wäre nicht schlecht
- wo sind hier Stolperfallen - auf was muss man achten.
- by the way - ist es ratsam immer als superuser zu arbeiten beim Installieren!?
Sorry - das ist nun etwas lange geworden - sorry es geht auch etwas durcheinander - aber da ich im Moment viel viel Zeit @home verbring habe ich Gelegenheit mich mit Python weiter zu befassen.
Und da packe ich Gelegenheit beim Schopf,
Viele Grüße u. allen noch einen schoenen Abend,
Say
vorweg: bin sehr froh dass ihr ein Forum(Unterforum habt, das für dem Thema Installation und Konfiguration vorbehalten ist. Super Sache und wie für mich gemacht.
,,,, ich bin am Aufbau einer Entwicklungsumgebung für Python auf zwei Systemen:
Win 10: mit PyCharm, VsCode u. ATOM (Bürorechner)
MX-Linux: mit ATOM (@home)
Zwischenfazit: also noch läuft das etwas holprig - auf der Linux-Kiste ist die Frage ob ich denn
a. alle Python-Pakete schon richtig eingerichtet habe und ob
b. ich auch die richtigen Plugins von Atom verwende - ferner hätter ich auf der MX-Linux 19.1 gerne halt auch
c. VSCode, das ist im Mom aber nicht in den Repositories drinne - die Installation kann via Flatpack oder Codium oder noch auf einem dritten
Wege laufen.... Alles in Allem halt etwas doof - aber ATOM ist - wenn alles gut eingerichtet ist ja auch nicht übel hat v.a. auch eine nette Github-Integration.
Es kommen also sicher zu beiden Systeme - zum Aufbau auf Windows 10 und auch auf der MX-Linux-Kiste sicher noch ein paar Fragen in den kommenden Tagen.
Hier ein Mini-Befund den ich eben im Büro mache:
Code: Alles auswählen
rom time import sleep
from time import time
from random import randint
from bs4 import BeautifulSoup
from requests import get
import pandas
#loop through individual webpages
pages = [str(i) for i in range(1,3)]
name = []
date = []
location = []
start_time = time()
requests = 0
for page in pages:
url = 'https://www.eventbrite.com/d/malaysia--kuala-lumpur--85675181/all-events/?page=' + str(page)
response = get(url)
sleep(randint(1,3))
requests += 1
elapsed_time = time() - start_time
print('Request: {}; Frequency: {} requests/s'.format(requests, requests/elapsed_time))
if response.status_code != 200:
print('Request: {}; Status Code: {}'.format(requests, response.status_code))
html_soup = BeautifulSoup(response.text, 'html.parser')
#main div
event_containers = html_soup.find_all('div', class_ = 'eds-media-card-content__content__principal')
for container in event_containers:
#get event name
event_name = container.h3.div.div.text
name.append(event_name)
#get event day & date
event_date = container.div.div.text
date.append(event_date)
#get event location
event_location = container.find('div', class_ = 'card-text--truncated__one')
location.append(event_location)
event_list = pandas.DataFrame({
'event': name,
'date': date,
'location': location})
event_list = event_list.drop_duplicates()
print(event_list)
und dient zu einem Test meines Systems hier
Code: Alles auswählen
Traceback (most recent call last):
File "C:/Users/foo_the_user/.PyCharmEdu2019.2/config/scratches/scratch.py", line 4, in <module>
from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'
Process finished with exit code 1
Doch - wenn man mal schaut was ich vorhin noch auf den Rechner draufgepackt habe dann ist das folgendes
Code: Alles auswählen
Windows PowerShell
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
Lernen Sie das neue plattformübergreifende PowerShell kennen – https://aka.ms/pscore6
PS C:\WINDOWS\system32> pip intall bs4
ERROR: unknown command "intall" - maybe you meant "install"
PS C:\WINDOWS\system32> pip install bs4
Collecting bs4
Downloading bs4-0.0.1.tar.gz (1.1 kB)
Requirement already satisfied: beautifulsoup4 in c:\program files\python37\lib\site-packages (from bs4) (4.8.2)
Requirement already satisfied: soupsieve>=1.2 in c:\program files\python37\lib\site-packages (from beautifulsoup4->bs4) (2.0)
Installing collected packages: bs4
Running setup.py install for bs4 ... done
Successfully installed bs4-0.0.1
PS C:\WINDOWS\system32> pip install pandas
Collecting pandas
Downloading pandas-1.0.3-cp37-cp37m-win_amd64.whl (8.7 MB)
|████████████████████████████████| 8.7 MB 6.4 MB/s
Collecting pytz>=2017.2
Downloading pytz-2019.3-py2.py3-none-any.whl (509 kB)
|████████████████████████████████| 509 kB 6.4 MB/s
Collecting numpy>=1.13.3
Downloading numpy-1.18.2-cp37-cp37m-win_amd64.whl (12.8 MB)
|████████████████████████████████| 12.8 MB 6.8 MB/s
Collecting python-dateutil>=2.6.1
Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
|████████████████████████████████| 227 kB 3.3 MB/s
Requirement already satisfied: six>=1.5 in c:\users\foo_the_user\appdata\roaming\python\python37\site-packages (from python-dateutil>=2.6.1->pandas) (1.12.0)
Installing collected packages: pytz, numpy, python-dateutil, pandas
Successfully installed numpy-1.18.2 pandas-1.0.3 python-dateutil-2.8.1 pytz-2019.3
PS C:\WINDOWS\system32> pip install time
ERROR: Could not find a version that satisfies the requirement time (from versions: none)
ERROR: No matching distribution found for time
PS C:\WINDOWS\system32> pip install request
Collecting request
Downloading request-2019.4.13.tar.gz (1.3 kB)
Collecting get
Downloading get-2019.4.13.tar.gz (1.3 kB)
Collecting post
Downloading post-2019.4.13.tar.gz (1.3 kB)
Requirement already satisfied: setuptools in c:\program files\python37\lib\site-packages (from request) (39.0.1)
Collecting query_string
Downloading query-string-2019.4.13.tar.gz (1.6 kB)
Collecting public
Downloading public-2019.4.13.tar.gz (2.3 kB)
Installing collected packages: public, query-string, get, post, request
Running setup.py install for public ... done
Running setup.py install for query-string ... done
Running setup.py install for get ... done
Running setup.py install for post ... done
Running setup.py install for request ... done
Successfully installed get-2019.4.13 post-2019.4.13 public-2019.4.13 query-string-2019.4.13 request-2019.4.13
PS C:\WINDOWS\system32> pip install request
und zur Linux Kiste hier noch gleich die Frage: ich hab auf der MX-Linux 19.1 ein Python 3.7.3 soweit so gut.
root@mx:/home/martin# python3 --V
unknown option --V
usage: python3 [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.
root@mx:/home/martin# python3 -V
Python 3.7.3
root@mx:/home/martin# pip install pandas
bash: pip: command not found.
pit ist noch nicht drauf.
Wenn ich dort z.B. pandas installieren will, dann läuft das nicht.
pip install pandas
Ich könnte, so glaube ich nun anfangs mal pip installieren.
1) Find the package at PyPI - the Python Package Index .
2) Download the source code,
3) Read the INSTALL.txt or README.txt for clue on installation.
4) Usually installation is made of these steps
$ python setup.py build
$ python setup.py install
ferner hab ich noch gelesen - dass man auch EasyBuild zu Installationszwecken verwenden könnte:
.....If you do not have EasyBuild installed yet, or if you just want to install the most recent version of each of the EasyBuild packages, you can use one of the following simple commands:
using easy_install (old tool, but still works):
Code: Alles auswählen
easy_install --prefix $HOME/EasyBuild easybuild
Note If we already have easybuild installed, we may need to instruct easy_install to install a newer version, using --upgrade or -U.
Aber es gilt offentsichtlich (dass man aufpassen muss):
using pip (more recent and better installation tool for Python software):
Code: Alles auswählen
pip install --install-option "--prefix=$HOME/EasyBuild" easybuild
The --prefix $HOME/EasyBuild part in these commands allows you to install EasyBuild without admin rights into $HOME/EasyBuild.
Note For pip v8.0 and newer,
Code: Alles auswählen
pip install --prefix=$HOME/EasyBuild easybuild works too.
Frage: Was aber ist davon zu halten:
pip is already installed if you are using Python 2 >=2.7.9 or Python 3 >=3.4 downloaded from python.org or if you are working in a Virtual Environment created by virtualenv or pyvenv. Just make sure to upgrade pip.Installing with get-pip.py To install pip, securely download get-pip.py by following this link: get-pip.py. Alternatively, use curl:
Code: Alles auswählen
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Then run the following command in the folder where you have downloaded get-pip.py:
Code: Alles auswählen
python get-pip.py
Warning Be cautious if you are using a Python install that is managed by your operating system or another package manager. get-pip.py does not coordinate with those tools, and may leave your system in an inconsistent state.
Nun stellt sich für mich die Frage: wie kann ich hier installieren. Welche generellen Optionen habe ich.
- pandas oder andere Module mit oder ohne pip installieren.
- pip einfach mal installieren.
- eine einfache Methoder fürs generelle installieren wäre nicht schlecht
- wo sind hier Stolperfallen - auf was muss man achten.
- by the way - ist es ratsam immer als superuser zu arbeiten beim Installieren!?
Sorry - das ist nun etwas lange geworden - sorry es geht auch etwas durcheinander - aber da ich im Moment viel viel Zeit @home verbring habe ich Gelegenheit mich mit Python weiter zu befassen.
Und da packe ich Gelegenheit beim Schopf,
Viele Grüße u. allen noch einen schoenen Abend,
Say