Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python still use default version not Venv

I have Ubuntu with already installed several Pythons:

/usr/bin/python2.7: Python 2.7.5
/usr/local/bin/python3.6: Python 3.6.10
/usr/local/bin/python3.6m: Python 3.6.10

All of them have no jupyter package.

So I have default commands pip, pip3, pip3.6, python, python3, python3.6 Also I have venv - virtual environment with jupyter installed. I activate it using command:

source /home/me/venv/bin/activate

But python command still using python2, python3 still use default python3.

I can't run python from venv and can't run jupyter notebook.

How to run python from env and how to start jupyter notebook?


I'm thinking about to rewrite alias for python link or maybe create new one, but don't know how to...

I can run go this way: cd home/me/venv/bin ./python3

and here runs right python version (from venv) and i can import jupyter in interpreter. But still can't run jupyter notebook in cmd

like image 813
Mikhail_Sam Avatar asked Nov 24 '25 18:11

Mikhail_Sam


1 Answers

You can use absolute or relative paths and the python -m MODULE syntax to be explicit about which python interpreter you want to use.

/home/me/venv/bin/python -m pip install notebook
/home/me/venv/bin/python -m jupyter notebook

I do not know why the activate script is not working for you. It should prepend your venv bin folder to the PATH so the venv python and other executables are found before other executables on your system.

like image 78
jakub Avatar answered Nov 26 '25 06:11

jakub



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!