I moved my Python 2.7 installation from C:\Python to D:\Python by simply moving the folder (I understand there are other ways to do this). When running D:\Python\python.exe, I can import system libraries and run things without any issues. However, I cannot run D:\Python\Scripts\ipython.exe. I get the following error:
Fatal error in launcher: Unable to create process using '"C:\Python\python.exe"
"D:\Python\Scripts\ipython.exe" '
It seems that ipython is aware of its original installation directory C:\Python, and attempts to access it. Are there any startup options or enviornmental variables I can use to force ipython to use the new installation directory?
Thanks.
EDIT:
The following process works completely fine. I first start Python via D:\Python\python.exe, and then run:
import IPython
IPython.start_ipython()
Why would this be different from running D:\Python\Scripts\ipython.exe?
解决方案
I also ran into this issue. The problem is that pip hardcodes the path to the Python interpreter for the executables in the Scripts folder (in this case IPython) at the time of the installation.
I don't think that is a way to control which Python interpreter pip should use for the executables. Currently, there are a couple of open issues on Github for pip that indicate that this is still an unsolved issue, e.g. https://github.com/pypa/pip/issues/2845.
However, I found a workaround described in this post http://www.clemens-sielaff.com/create-a-portable-python-with-pip-on-windows/ that works for me. Basically, just open the exe file in a text editor and edit the path to the Python interpreter (you will find it almost at the end of the file as #!). I'm using #!python since I know that my Python interpreter of choice will be first in path.