point to a newer version of python

225 views
Skip to first unread message

Pavlos Parissis

unread,
Jul 9, 2016, 3:52:50 PM7/9/16
to virtualenvwrapper
Hi,

I had python 3.5.1 installed under /opt/python35 and have created several envs which were using that version.
I went and deleted /opt/python35 and installed python 3.5.2.

How do I make my envs to use 3.5.2? lunching python3 within the envs gives me 3.5.1.

Cheers,
Pavlos

Doug Hellmann

unread,
Jul 9, 2016, 4:13:37 PM7/9/16
to virtuale...@googlegroups.com
I think if you installed the new version to the same location it should work, but that may be a platform-specific behavior.

If that doesn’t work, you can run virtualenv directly to recreate the environment.

$ cd $WORKON_HOME
$ virtualenv my_env


Cheers,
Pavlos

--
You received this message because you are subscribed to the Google Groups "virtualenvwrapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to virtualenvwrap...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pavlos Parissis

unread,
Jul 9, 2016, 4:26:46 PM7/9/16
to virtualenvwrapper
I see the binary is copied into env:

bar at foo in ~
workon python35
(python35)bar at foo in ~
cdvirtualenv
(python35)bar at foo in ~/.virtualenvs/python35
cd bin
(python35)bar at foo in ~/.virtualenvs/python35/bin
ls -ls python*
    0 lrwxrwxrwx 1 bar bar        9 Mar 14 20:44 python -> python3.5
    0 lrwxrwxrwx 1 bar bar        9 Mar 14 20:44 python3 -> python3.5
11516 -rwxr-xr-x 1 bar bar 11789232 Mar 14 20:44 python3.5

(python35)bar at foo in ~/.virtualenvs/python35/bin
./python3.5
Python 3.5.1 (default, Mar 14 2016, 20:39:50)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
(python35)bar at foo in ~/.virtualenvs/python35/bin
/opt/python3.5/bin/python3
python3            python3.5          python3.5-config   python3.5m         python3.5m-config  python3-config
(python35)bar at foo in ~/.virtualenvs/python35/bin
/opt/python3.5/bin/python3.5
Python 3.5.2 (default, Jul  9 2016, 09:53:25)
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
(python35)bar at foo in ~/.virtualenvs/python35/bin

I was hoping that I could  avoid recreating my envs.

Cheers,
Pavlos

Doug Hellmann

unread,
Jul 9, 2016, 4:37:28 PM7/9/16
to virtuale...@googlegroups.com
I was hoping that I could  avoid recreating my ends.

Running virtualenv for an existing environment should just update it, and leave everything installed.

Doug

Pavlos Parissis

unread,
Jul 9, 2016, 4:45:56 PM7/9/16
to virtualenvwrapper

I tried that but got an error about OSError: [Errno 40] Too many levels of symbolic links::


bar at foo in ~
cd $WORKON_HOME

bar at foo in ~/.virtualenvs
virtualenv -p /opt/python3.5/bin/python3 python3
python3/  python35/

bar at foo in ~/.virtualenvs
virtualenv -p /opt/python3.5/bin/python3 python35
Running virtualenv with interpreter /opt/python3.5/bin/python3
Using base prefix '/opt/python3.5'
New python executable in python35/bin/python3
Not overwriting existing python script python35/bin/python (you must use python35/bin/python3)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 2378, in <module>
    main()
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 830, in main
    symlink=options.symlink)
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 999, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 1467, in install_python
    raise e
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 1459, in install_python
    stdout=subprocess.PIPE)
  File "/opt/python3.5/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/opt/python3.5/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
OSError: [Errno 40] Too many levels of symbolic links


Cheers,
Pavlos

Doug Hellmann

unread,
Jul 9, 2016, 5:01:21 PM7/9/16
to virtuale...@googlegroups.com
OK, I’m not sure why that would be. I know I’ve done this, so it may be something different about your setup (I don’t usually build Python from source).

You might have better luck asking in the virtualenv help channels.

Doug
Reply all
Reply to author
Forward
0 new messages