Windows 10 Bash和python路径 [英] Windows 10 Bash and python paths

查看:211
本文介绍了Windows 10 Bash和python路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近安装了Windows bash.我试图通过将它们添加到PYTHONPATH变量中使与Anaconda一起安装的软件包可见,但该文件未在环境中列出.

I've recently installed the windows bash. I tryed to make the packages installed with Anaconda visible by adding them to the PYTHONPATH variable but it is not listed in the environment.

足够有意思的sys.path.append可以正常工作并具有条目,例如

Couriously enough sys.path.append works just fine and has entries, as sys.path doc states that the package variable is instatiated from the environment variable PYTHONPATH, but how can it be if it is not present in the environment (Bash of windows)?

我已经检查过Windows环境,它们是分开的系统(否则,Anaconda包将可用于导入).那么在哪里可以在Windows bash中将python路径设置为新模块呢?

I've already checked the windows environment and they're as separated system (otherwise the Anaconda packages would be available for import). So where can I set the python paths to new modules in windows bash?

推荐答案

如果您是从Windows bash启动python,它将无法从Windows自动找到您的PYTHONPATH环境变量.您需要自己添加.您可以通过编辑.bashrc文件来实现.它位于您的主目录(/home/userid或只是〜).

If you are launching python from windows bash it won't automatically find your PYTHONPATH environment variable from windows. You need to add it yourself. You can do this by editing the .bashrc file. It is located in your home directory (/home/userid or just ~).

vi ~/.bashrc

现在添加以下行:

export PYTHONPATH="/mnt/c/my/python/path"

这篇关于Windows 10 Bash和python路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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