... | @@ -23,32 +23,44 @@ pip through this link [Pip Installation](https://pip.pypa.io/en/stable/installin |
... | @@ -23,32 +23,44 @@ pip through this link [Pip Installation](https://pip.pypa.io/en/stable/installin |
|
|
|
|
|
Setting up a venv is a lot straightforward, all we need to do is run a few commands at a terminal console.
|
|
Setting up a venv is a lot straightforward, all we need to do is run a few commands at a terminal console.
|
|
|
|
|
|
|
|
We need to go to the project folder.
|
|
|
|
>`cd <PROJECT DIRECTORY>`
|
|
|
|
|
|
|
|
Then we create a folder named "venv".
|
|
|
|
>`mkdir venv`
|
|
|
|
|
|
|
|
Now we setup a virtual environment with this command.
|
|
|
|
>`python3 -m venv /venv`
|
|
|
|
|
|
|
|
And activate it.
|
|
|
|
>`source venv/bin/activate`
|
|
|
|
(After running this command you will see in the terminal that at the start of the line is a (venv), this mean that all you run from now will be applied only into this virtual environment)
|
|
|
|
|
|
## Installing virtual environment
|
|
## Installing virtual environment
|
|
|
|
|
|
With all the pre steps finished, you can continue with the installation of the virtual enviroment
|
|
With all the pre steps finished, you can continue with the installation of the virtual environment.
|
|
<br><br>
|
|
<br><br>
|
|
On the terminal type
|
|
On the terminal type
|
|
> pip install pipenv
|
|
> pip3 install pipenv
|
|
|
|
|
|
* The command will install the pipenv library to manage the virtual enviroments on your machine
|
|
* The command will install the pipenv library to manage the virtual environments on your machine.
|
|
|
|
|
|
<br><br>
|
|
<br><br>
|
|
Going to the project folder you must type
|
|
Going to the project folder you must type:
|
|
> pipenv install
|
|
> pipenv install
|
|
|
|
|
|
* It will install all the required dependencies in the project
|
|
* It will install all the required dependencies in the project using as parameter the Pipfile in the root of the project directory.
|
|
|
|
|
|
***
|
|
***
|
|
|
|
|
|
## PyCharm
|
|
## PyCharm
|
|
|
|
|
|
If the virtual enviroment was not already set by the IDE, you must configure it to run the project.
|
|
If the virtual environment was not already set by the IDE, you must configure it to run the project.
|
|
1. Opening the IDE you can use the shortcut `ctrl + alt + s` to open the project settings
|
|
1. Opening the IDE you can use the shortcut `ctrl + alt + s` to open the project settings
|
|
2. Once popped up on the screen, open the `Project: Desastres` tab
|
|
2. Once popped up on the screen, open the `Project: Desastres` tab
|
|
3. Select `Project Interpreter`
|
|
3. Select `Project Interpreter`
|
|
4. On the right side of the path to the current virtual enviroment or the '<No interpreter>' field, click on the engine and `Add...`
|
|
4. On the right side of the path to the current virtual environment or the '<No interpreter>' field, click on the engine and `Add...`
|
|
5. Select the `Existing enviroment` radio button
|
|
5. Select the `Existing environment` radio button
|
|
6. On the right side of "<No interpreter>" or the old path of the enviroment, select the `...` button and chose the path to the interpreter
|
|
6. On the right side of "<No interpreter>" or the old path of the environment, select the `...` button and chose the path to the interpreter
|
|
|
|
|
|
Tip: The interpreter probably is inside the `.virtualenvs` folder created on your user profile |
|
Tip: The interpreter probably is inside the `.virtualenvs` folder created on your user profile |