简体   繁体   中英

About virtualenv and version of python?

I need help in understanding with venv. I have installed venv with virtualenv venv -p python3.6. I have activated it (venv) and install django

pip django`install django`

And so, when I work with my project should I always activate venv or not? Because I run my manage.py without venv and using python2, but I need python3. And then I run with active venv with python3 I got mistakes like this:

ModuleNotFoundError: No module named 'forms'

I also use python3.5.2 and I created a virtual environment using the following command

python3 -m venv venv

And activated it using the following command

. venv/bin/activate

I always activate the virtual environment before running the application

您必须在调用pip install ... (可能在Python 3.x中使用pip3 )之前以及每次需要使用virtualenv时(例如,在调用python manage.py ...之前)激活virtualenv python manage.py ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM