Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

219.md PYTHONPATH 环境变量 #36

Open
Hsinwe opened this issue Dec 7, 2015 · 3 comments
Open

219.md PYTHONPATH 环境变量 #36

Hsinwe opened this issue Dec 7, 2015 · 3 comments

Comments

@Hsinwe
Copy link

Hsinwe commented Dec 7, 2015

应该是 export PYTHONPATH = /home/qw/python:$PYTHONPATH ,然后执行 source /etc/profile 。
最后的代码段中,cd python 后使用 python 命令进入交互模式,然后引用 mypm 模块一定会成功,因为 sys.path 返回的列表中第 0 项 '' 空字符串就是指当前文件夹 (/python) 。

@qiwsir
Copy link
Owner

qiwsir commented Dec 7, 2015

已经修改,请看:https://github.com/qiwsir/StarterLearningPython/blob/master/219.md
,是否妥当?请指正。

2015-12-07 11:54 GMT+08:00 Hsinwe [email protected]:

应该是 export PYTHONPATH = /home/qw/python:$PYTHONPATH ,然后执行 source
/etc/profile 。
最后的代码段中,cd python 后使用 python 命令进入交互模式,然后引用 mypm 模块一定会成功,因为 sys.path
返回的列表中第 0 项 '' 空字符串就是指当前文件夹 (/python) 。


Reply to this email directly or view it on GitHub
#36.

QiWei

@Hsinwe
Copy link
Author

Hsinwe commented Dec 7, 2015

我觉得后面 cd python | python | import mypm 的示例可以改成 cd anotherpython | python | import mypm, sys | sys.path ,以此显示告知的效果。不理解为什么老师使用的是引用当前工作文件夹中的模块的例子?

@qiwsir
Copy link
Owner

qiwsir commented Dec 8, 2015

你说的有道理。但是并没有在这方面思想太多。我倒是觉得,把你这个问题发到教程中,让学习者来体会,更好一些。这样能引导大家动脑筋。比看我写的强多了。多谢你的指正。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants