2

In MACOS terminal, when I do python3 -V, I get this:

Python 3.7.6

now I create a virtualenv by doing this:

dev$ python3 -m venv project-one

and activate by doing this:

dev$ source project-one/bin/activate 

I have a requirement.txt file with the following:

python==3.6.8
numpy==1.18.1
matplotlib==3.1.1

now I do pip3 install requirement.txt

but I get this error:

ERROR: Could not find a version that satisfies the requirement requirements.txt

I used several python3.6.x version but it does not work.

What do I want?

I want to have a virtualenv with Python version python3.6.x so when I run any code inside the virtualenv, it is via python3.6.x

snakecharmerb
  • 47,570
  • 11
  • 100
  • 153
floss
  • 2,603
  • 2
  • 20
  • 37
  • 2
    I would recommend checking out [`pyenv`](https://github.com/pyenv/pyenv) for Python version control, and [`pyenv-virtualenv`](https://github.com/pyenv/pyenv-virtualenv) to manage virtual environments with different Python versions. Should be straight forward to install both: `brew install pyenv` ([brew.sh](https://brew.sh)) – felipe Jan 26 '20 at 01:14
  • You omitted the `-r` flag that denotes you are using a requirements file. `pip3 install -r requirement.txt` – snakecharmerb Oct 13 '20 at 08:15
  • Does this answer your question? [How to use virtualenv with python3.6 on ubuntu 16.04?](https://stackoverflow.com/questions/47822740/how-to-use-virtualenv-with-python3-6-on-ubuntu-16-04) – Eypros Oct 13 '20 at 09:01

2 Answers2

0

Just do

virtualenv -ppython3 .venv

That will create virtualenv with python 3. You can also be more specific:

virtualenv -ppython36 .venv

if you have it installed.

Stanislav
  • 826
  • 11
  • 17
0

Do this, it needs root permission to fetch pythonx from the internet if it's not locally installed.

sudo apt install python3.6-venv