Category:Python: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Category:Hacking = buffering = Fix CLI buffering in Python with: <pre> $ python -u foo.py | tee mylog.log </pre> "-u" means unbuffered, or something") |
No edit summary |
||
Line 7: | Line 7: | ||
"-u" means unbuffered, or something | "-u" means unbuffered, or something | ||
= Virtual Environments = | |||
<syntaxhighlight lang="bash"> | |||
# Check Python version | |||
python3 --version | |||
# Check pip version | |||
pip3 --version | |||
# Install virtualenv | |||
pip3 install virtualenv | |||
# Navigate to your project directory | |||
cd ~/my_project/ | |||
# Create virtual environment | |||
python3 -m venv myenv | |||
# Activate virtual environment | |||
source myenv/bin/activate | |||
# Now you can install packages | |||
pip install <your-package> | |||
# Deactivate when you're done | |||
deactivate | |||
</syntaxhighlight> |
Revision as of 01:19, 13 September 2023
buffering
Fix CLI buffering in Python with:
$ python -u foo.py | tee mylog.log
"-u" means unbuffered, or something
Virtual Environments
# Check Python version
python3 --version
# Check pip version
pip3 --version
# Install virtualenv
pip3 install virtualenv
# Navigate to your project directory
cd ~/my_project/
# Create virtual environment
python3 -m venv myenv
# Activate virtual environment
source myenv/bin/activate
# Now you can install packages
pip install <your-package>
# Deactivate when you're done
deactivate
Pages in category "Python"
The following 7 pages are in this category, out of 7 total.