-->

Trouble installing venv python 2.7.12

2019-09-19 06:15发布

问题:

I am currently learning Flask and to do so I have to install virtualenv. It installs it normally but after that I have to activate the environment. In the tutorial it says that I have to type this into CMD: venv\scripts\activate

It gives me the error: "The system cannot find the path specified".

I tried to run this and it doesn't work either:

venv\Scripts\activate.bat

Any help will be really appreciated.

回答1:

First make sure where your working directory of your project is,lets say you have your venv in a directory called FolderX. Go to the directory's location, hold shift and right click on it then click on "Open terminal here" from the right click option.Now that you have terminal/cmd opened in that directory, type in venv\Scripts\activate.bat or venv\Scripts\activate. Do make sure that you have activate.py or activate.bat in the specific path.

You can also try this if not installed:

 pip install virtualenv

If you have it installed,create another virtual environment for the project.Type these in your terminal:

cd my_project_folder
virtualenv venv
venv/bin/activate