Wiki source code of How to Run a Python Script in a VirtualEnv
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
2.1 | 1 | After you have [[created a virtualenv>>doc:Main.How to Create a VirtualEnv.WebHome]], and [[installed some libraries in the virtualenv>>doc:Computing Newbies.Python Newbies.How to add libraries to a virtualenv.WebHome]], you should run your script in the virtualenv if your script makes use of the libraries that you installed. |
![]() |
1.1 | 2 | |
3 | Assuming that your script is at /abc/def/efg.py... | ||
4 | |||
5 | In your console [[change working directory>>doc:Main.How to Deal with Working Directory in Console.WebHome]] to your virualenv and type: | ||
6 | |||
7 | {{code language="plain"}} | ||
8 | bin/python3 /abc/def/efg.py | ||
9 | {{/code}} | ||
10 | |||
11 | In Windows you should type: | ||
12 | |||
13 | {{code language="plain"}} | ||
14 | scripts\python3.exe C:\abc\def\efg.py | ||
15 | {{/code}} | ||
16 | |||
17 | if your file is in C:\abc\def\efg.py in windows. |