Create virtualenv for python 2.7 with python 3.10

Advertisements I am trying to create a virtual environment for python 2.7 on Ubuntu 22.04. I always receive an error as follows: RuntimeError: failed to query /usr/bin/python2.7 with code 1 err: ‘ File "/usr/local/lib/python3.10/dist-packages/virtualenv/discovery/py_info.py", line 152\n os.path.join(base_dir, exe) for exe in (f"python{major}", f"python{major}.{minor}")\n ^\nSyntaxError: invalid syntax\n’ Here is a capture of my terminal for useful… Read More Create virtualenv for python 2.7 with python 3.10

i use python 3.10 how should i create a python 3.8 virtual environment in vscode?

Advertisements I’m using python 3.10 in vs code and i have to create a project using python 3.8 so how could i create a virtual environment with python 3.8? i tried in the vs code command prompt python -m venv venv, it is creating the environment but i cannot find the required version of python.… Read More i use python 3.10 how should i create a python 3.8 virtual environment in vscode?

i use python 3.10 how should i create a python 3.8 virtual environment in vscode?

Advertisements I’m using python 3.10 in vs code and i have to create a project using python 3.8 so how could i create a virtual environment with python 3.8? i tried in the vs code command prompt python -m venv venv, it is creating the environment but i cannot find the required version of python.… Read More i use python 3.10 how should i create a python 3.8 virtual environment in vscode?

Can I just delete the venv folder in django to delete virtual environment?

Advertisements I am trying to remove an old virtual env from a django project and just create a new one from the beginning. However, I am concerned if it is okay to just delete the venv folder through my windows file explorer. I have researched online, but I couldn’t find a suitable and clear answer… Read More Can I just delete the venv folder in django to delete virtual environment?

Run Python script that affect parent shell (changes environment variables, runs other scripts, etc.)

Advertisements Recently I need to affect bash shell that runs python script from python script itseft. I develop a Python utility package that add some additional functionallity to pip. One of the workflows in this package needs to active Virtualenv to work as planned. Here is the problem. When you run something like: os.system(‘/bin/bash ./venv/bin/activate’)… Read More Run Python script that affect parent shell (changes environment variables, runs other scripts, etc.)

Python if statement with string as condition

Advertisements There’s some code in virtualenv that’s tripping me up. It’s this: path.decode("utf-8") if "__DECODE_PATH__" else path from activate_this.py line 28. How can if "__DECODE_PATH__" ever be false? It’s possible it’s a bug, but since it’s in virtualenv and since activate_this.py is the means of activating virtualenv in the current interpreter, it’s seems unlikely. Also… Read More Python if statement with string as condition

Python problem with extensions in virtual enviroment

Advertisements I am using python 3.7.5 version, however I downloaded 3.6 version for specific project and created virtual enviroment, installed required extensions (numpy, matplotlib…). However when I try to run python script, there comes a lot of errors related to extensions. The code worked flawlessly with 3.7 version of python. Any thoughts what can be… Read More Python problem with extensions in virtual enviroment