Python Forum

Full Version: How to use/install different versions of Python packages (Scipy) on the same system?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am new to Python and a I need to performe some calculations using the package Scipy.
I installed Scipy (0.14) from synaptic and implemented the desired code.
Everything worked well.
Now, I realized that I need to download a newer version of the source code (more precisely, https:// github.com/ scipy/scipy/blob/master/scipy/optimize/ slsqp.py) and modify it before performing the calculations.

How can I use the modified code without changing the installed version?

It follows a simple version of the problem I need to solve
import numpy as np
import scipy
from scipy.optimize import minimize # here I need to insert the modified code

#######################

def blackbox(x):
fit = 0
for val in x:
fit = fit + val*val

return fit


#######################


x0=[1,1]


print scipy.__version__

res = minimize(blackbox, x0, method='SLSQP', options={'disp': True, 'maxiter':10, 'eps': 0.01, 'ftol': 1e-05})

print(res.x)
A safe way would be to install a second identical python version in a different path. Then one python install would have one scipy version and the other python install would have another scipy version.
(Nov-06-2016, 10:14 PM)gzb001 Wrote: [ -> ]How can I use the modified code without changing the installed version?
The obvious choice is to use Virtualenv intro Virtual Environments.
I wish I knew that 3 days ago, I would not have to lose all of my 3.5 stuff.
I ma going to try that and see if it works.