在控制台启动时,在pydev(Eclipse)中设置Interactive Console的当前目录 [英] Setting current directory for Interactive Console in pydev (Eclipse) at console startup

查看:187
本文介绍了在控制台启动时,在pydev(Eclipse)中设置Interactive Console的当前目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从项目目录中的pydev启动一个交互式控制台,以便导入应用程序。我试图在启动时使用os.chdir从Window-> Preferences-> PyDev-> Interactive Console-> Initial interpreter命令。
我阅读了 https://docs.djangoproject.com/en/dev/参考/设置/ 搜索条目设置路径,但我没有找到任何东西。
谢谢

I want to start an interactive console in pydev from project directory, in order to import an app. I tried to use os.chdir at startup from Window->Preferences->PyDev->Interactive Console->Initial interpreter commands. I read https://docs.djangoproject.com/en/dev/ref/settings/ searching for an entry to set path but I didn't find anything. Thanks

编辑:为了导入应用程序,我不得不导入模块

I had to import module first in order to import app

推荐答案

奇怪的是,在更改初始解释器命令后,我必须说:

Strange, I must say that after changing the initial interpreter commands to be:

import sys; print('%s %s' % (sys.executable or sys.platform, sys.version))
import os;os.chdir('c:\\')

稍后(在shell中):

Later doing (in the shell):

import os.path
os.path.abspath('.')



Does show the expected path... Aren't you getting that? What do you get when you do the abspath('.') in the shell after the startup?

这篇关于在控制台启动时,在pydev(Eclipse)中设置Interactive Console的当前目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆