https://github.com/julioaranajr/01_python_pythonenv_labs
# Learning Python - Config Python Environment and Examples
https://github.com/julioaranajr/01_python_pythonenv_labs
examples how-to pyenv python-labs python3
Last synced: 11 months ago
JSON representation
# Learning Python - Config Python Environment and Examples
- Host: GitHub
- URL: https://github.com/julioaranajr/01_python_pythonenv_labs
- Owner: julioaranajr
- Created: 2022-09-29T07:14:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-07T09:09:56.000Z (over 3 years ago)
- Last Synced: 2025-01-09T07:12:58.215Z (about 1 year ago)
- Topics: examples, how-to, pyenv, python-labs, python3
- Language: Python
- Homepage:
- Size: 453 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Learning Python
## Prepare pyenv
```sh
PYTHON_VERSION="3.10.5"
brew install pyenv
pyenv install $PYTHON_VERSION
pyenv global $PYTHON_VERSION
```
Open your `.zshrc` file and add the lines below at the end of the file.
```sh
code ~/.zshrc
```
**or**, use `vi`
```sh
vi ~/.zshrc
```
Copy and paste the following lines:
```
# Python - pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
```
You should now close your terminal `exit` and re-open it.
Check python and pip
```sh
which python
which pip
```
## Some Utilities of pyenv
List of existing version installed on your mac:
```sh
pyenv versions
```
Set a new version of python on your mac:
```sh
pyenv global $PYTHON_VERSION
```
## Your First Python Program
Create a new file
```sh
code hello.py
```
Edit your file with visual studio and write this line:
```py
print("Hello World")
```
Run the script **hello.py** in your terminal
```sh
python hello.py
```
## Running
