Questions about virtualenv

2

I'm starting development with virtualenv and some doubts have arisen, they are:

  • Should Python scripts be inside the virtual environment folder?
  • In the PyCharm IDE, do you need to configure something to develop in the enabled virtual environment?
  • If I need to run the scripts on another machine that does not have the virtual environment set up, do I need to configure it from scratch?
  • asked by anonymous 26.07.2017 / 21:34

    1 answer

    2

    The answer to the first question is: No! and does not seem to make sense, what I see (and do not use) is the opposite, the venv be in a directory within your project.

    Yes, in pycharm you have to say with which venv your project will work, set it to File / settings / project interpreter.

    Theanswertothethirdquestionis:Notnecessarily!Theconceptofvirtualsendstothedeveloper,sothathecanhaveseveraldevelopmentenvironmentsonhisworkstation,inthiswayonecandevelopeprojectsinpython2,python3,etc.,simplyby"switching" the environments.

    In the machine that will run the project must have all the packages required by the same, whether or not in a virtual env. To do this use a requirements file, commonly called requirements.txt

    To start managing virtual environments in python, consider using anaconda. See, here in STOpt, this answer , and open that door with a golden key. : -)

        
    26.07.2017 / 22:24