ipython安装不了_移动Python安装文件夹不会更新ipython路径

1586010002-jmsa.png

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值