0

Cloud9 (an online ide) doesn't seem to support my virtual environment:

me:~/workspace/dir (master) $ source venv/bin/activate
(venv) me:~/workspace/dir (master) $ which python
/usr/bin/python

This same virtual directory worked fine on my local machine:

(venv) me$ which python
/Users/me/dir2/dir/venv/bin/python

How can I fix this?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Bren
  • 3,516
  • 11
  • 41
  • 73

1 Answers1

0

The following works for me. sudo apt-get install python3.5-venv python3.5 -m venv --clear ./mypy3.5/ source ./mypy3.5/bin/activate It uses the (mypy3.5) $ which python /home/ubuntu/mypy3.5/bin/python

But there is a gotcha which might have been your problem. The python3 -m venv uses soft links to how your python resolves in your environment. I had Python 3.3, 3.4 and 3.5 installed in /usr/local so the /usr/local/bin/python3 would change and break my Python3 venv. Note that "python3" is evaluated for the environment not for an absolute path. To be careful, when there are more than one Python 3 on you system, create your virtual environment with an explicit path like the following. /usr/bin/python3.5 -m venv --clear ./mypy3.5/ source ./mypy3.5/bin/activate ls -l $(which python3.5) /home/ubuntu/mypy3.5/bin/python3.5 -> /usr/bin/python3.5*

cmobarry
  • 1
  • 1