From b7fbd03aef3f962813d21729832f9fda8c9caff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Sun, 8 Sep 2024 16:57:04 +0200 Subject: [PATCH] Virtual environments, Basic script template --- README.md | 15 ++++++--------- index.html | 15 +++++++-------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index f2b4084..ee0ee6c 100644 --- a/README.md +++ b/README.md @@ -3538,22 +3538,19 @@ cdef class : self. = ``` -```python -cdef enum : , , ... -``` - ### Virtual Environments **System for installing libraries directly into project's directory.** ```bash -$ python3 -m venv # Creates virtual environment in current directory. -$ source /bin/activate # Activates venv. On Windows run `\Scripts\activate`. -$ pip3 install # Installs the library into active environment. -$ python3 # Runs the script in active environment. Also `./`. -$ deactivate # Deactivates the active virtual environment. +$ python3 -m venv NAME # Creates virtual environment in current directory. +$ source NAME/bin/activate # Activates env. On Windows run `NAME\Scripts\activate`. +$ pip3 install LIBRARY # Installs the library into active environment. +$ python3 FILE # Runs the script in active environment. Also `./FILE`. +$ deactivate # Deactivates the active virtual environment. ``` ### Basic Script Template +**Run the script with `'$ python3 FILE'` or `'$ chmod u+x FILE; ./FILE'`. To automatically start the debugger when uncaught exception occurs run `'$ python3 -m pdb -cc FILE'`.** ```python #!/usr/bin/env python3 # diff --git a/index.html b/index.html index eb06d2d..de8379e 100644 --- a/index.html +++ b/index.html @@ -2886,17 +2886,15 @@ ex.line(df, x='Date', y=def __init__(self, <ctype> <arg_name>): self.<attr_name> = <arg_name> -
cdef enum <enum_name>: <member_name>, <member_name>, ...
-
-

Virtual Environments

System for installing libraries directly into project's directory.

$ python3 -m venv <name>      # Creates virtual environment in current directory.
-$ source <name>/bin/activate  # Activates venv. On Windows run `<name>\Scripts\activate`.
-$ pip3 install <library>      # Installs the library into active environment.
-$ python3 <path>              # Runs the script in active environment. Also `./<path>`.
-$ deactivate                  # Deactivates the active virtual environment.
+

Virtual Environments

System for installing libraries directly into project's directory.

$ python3 -m venv NAME      # Creates virtual environment in current directory.
+$ source NAME/bin/activate  # Activates env. On Windows run `NAME\Scripts\activate`.
+$ pip3 install LIBRARY      # Installs the library into active environment.
+$ python3 FILE              # Runs the script in active environment. Also `./FILE`.
+$ deactivate                # Deactivates the active virtual environment.
 
-

Basic Script Template

#!/usr/bin/env python3
+

Basic Script Template

Run the script with '$ python3 FILE' or '$ chmod u+x FILE; ./FILE'. To automatically start the debugger when uncaught exception occurs run '$ python3 -m pdb -cc FILE'.

#!/usr/bin/env python3
 #
 # Usage: .py
 #
@@ -2925,6 +2923,7 @@ $ deactivate                  # Deactivates the activ
     main()
 
+

#Index

  • Only available in the PDF.
  • Ctrl+F / ⌘F is usually sufficient.
  • Searching '#<title>' will limit the search to the titles.