pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

VSCode 終端顯示不正確的 python 版本和路徑,從

VSCode terminal shows incorrect python version and path, launching terminal from anaconda works perfectly(VSCode 終端顯示不正確的 python 版本和路徑,從 anaconda 啟動終端工作正常) - IT屋-程序員軟件開發技術分享
本文介紹了VSCode 終端顯示不正確的 python 版本和路徑,從 anaconda 啟動終端工作正常的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我已經被這個問題困擾了好幾個小時,并且相信我已經嘗試了所有方法,除了把我的電腦扔出窗外.

I have been stuck on this one problem for hours now and believe I have tried everything outside of throwing my computer out of the window.

我使用 python 3.7 版和 Django 2.1 版在 Anaconda 上設置了一個虛擬環境.如果我從 Anaconda 激活這個虛擬環境,一切都會順利進行.

I have a virtual environment set up on Anaconda using python version 3.7 and Django version 2.1. If I activate this virtual environment from Anaconda everything works smoothly.

(movierecommender) bash-3.2$ python -V
Python 3.7.2
(movierecommender) bash-3.2$ python -m django --version
2.1.5

但是,當我嘗試從 vscode 終端激活環境時,我得到了

However when I try to activate the environment from a vscode terminal I get

(movierecommender) maxs-MBP:movies maxswann$ python -V
Python 2.7.10
(movierecommender) maxs-MBP:movies maxswann$ python -m django --version
/usr/bin/python: No module named django

我有 Python 3.7.2 64 位 ('movierecommender':conda)在我的 vscode 窗口左下角顯示為我的 python 解釋器,但仍然得到錯誤的 python 版本

I have Python 3.7.2 64-bit ('movierecommender':conda) showing as my python interpreter in the bottom left of my vscode window yet still get the wrong python version

我認為這可能與 PYTHONPATH 有關,但嘗試取消設置和重置,即使我不必擔心 Anaconda 中的這一點,因為它會自動添加:"python.pythonPath":"/Users/maxswann/anaconda3/envs/movierecommender/bin/python"到 settings.json.vscode 文件

I thought this may be to do with the PYTHONPATH but have tried unsetting and resetting even though I should not have to worry about this in Anaconda as it automatically adds: "python.pythonPath":"/Users/maxswann/anaconda3/envs/movierecommender/bin/python" to a settings.json.vscode file

使用:

python -c "import sys; print(sys.path)"

Anaconda 推出的終端

Anaconda-launched terminal

['', '/Users/maxswann/anaconda3/envs/movierecommender/lib/python37.zip', '/Users/maxswann/anaconda3/envs/movierecommender/lib/python3.7', '/Users/maxswann/anaconda3/envs/movierecommender/lib/python3.7/lib-dynload', '/Users/maxswann/anaconda3/envs/movierecommender/lib/python3.7/site-packages']

VS代碼終端

['', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Python/2.7/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC']

如您所見,它似乎使用的是默認的 mac OS python 版本.

As you can see it seems to be using the default mac OS python version.

以前有沒有其他人遇到過這個問題?我整天都在扯頭發試圖解決這個問題

Has anybody else had this problem before? I've been tearing hair out all day trying to fix this

推薦答案

我也遇到了同樣的問題.終于從論壇(https://github.com/Microsoft/vscode-python/issues/4434#issuecomment-466600591)

I have been facing the exact same problem. Finally found a workaround from a forum (https://github.com/Microsoft/vscode-python/issues/4434#issuecomment-466600591)

只要在配置中添加一些東西,terminal.integrated.env.osx,在shell初始化(source bash_profile or zshrc)后,內容會附加到PATH).在我的 Mojave 中,我只需將以下空條目添加到我的用戶配置中:

As long as you ADD some stuff to configuration, terminal.integrated.env.osx, the content will be appended to PATH after shell initialization(source bash_profile or zshrc). In my Mojave, I simply add following empty entry to my user configuration:

"terminal.integrated.env.osx": {
        "PATH": ""
}

那么$PATH就和外部終端一樣了.

Then the $PATH will be the same as the external terminal.

這篇關于VSCode 終端顯示不正確的 python 版本和路徑,從 anaconda 啟動終端工作正常的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Troubles while parsing with python very large xml file(使用 python 解析非常大的 xml 文件時出現問題)
Find all nodes by attribute in XML using Python 2(使用 Python 2 在 XML 中按屬性查找所有節點)
Python - How to parse xml response and store a elements value in a variable?(Python - 如何解析 xml 響應并將元素值存儲在變量中?)
How to get XML tag value in Python(如何在 Python 中獲取 XML 標記值)
How to correctly parse utf-8 xml with ElementTree?(如何使用 ElementTree 正確解析 utf-8 xml?)
Parse XML from URL into python object(將 XML 從 URL 解析為 python 對象)
主站蜘蛛池模板: 捷码低代码平台 - 3D数字孪生_大数据可视化开发平台「免费体验」 | 软装设计-提供软装装饰和软装配饰及软装陈设的软装设计公司 | 沈阳激光机-沈阳喷码机-沈阳光纤激光打标机-沈阳co2激光打标机 | 金属检测机_金属分离器_检针验针机_食品药品金属检探测仪器-广东善安科技 | 电动葫芦|手拉葫芦|环链电动葫芦|微型电动葫芦-北京市凌鹰起重机械有限公司 | 合肥钣金加工-安徽激光切割加工-机箱机柜加工厂家-合肥通快 | 不发火防静电金属骨料_无机磨石_水泥自流平_修补砂浆厂家「圣威特」 | 天长市晶耀仪表有限公司| 岩棉板|岩棉复合板|聚氨酯夹芯板|岩棉夹芯板|彩钢夹芯板-江苏恒海钢结构 | 实战IT培训机构_IT培训班选大学生IT技术培训中心_中公优就业 | 金环宇|金环宇电线|金环宇电缆|金环宇电线电缆|深圳市金环宇电线电缆有限公司|金环宇电缆集团 | 首页-恒温恒湿试验箱_恒温恒湿箱_高低温试验箱_高低温交变湿热试验箱_苏州正合 | 矿用履带式平板车|探水钻机|气动架柱式钻机|架柱式液压回转钻机|履带式钻机-启睿探水钻机厂家 | 高低温试验房-深圳高低温湿热箱-小型高低温冲击试验箱-爱佩试验设备 | 济南品牌包装设计公司_济南VI标志设计公司_山东锐尚文化传播 | CCC验厂-家用电器|服务器CCC认证咨询-奥测世纪 | 手机游戏_热门软件app下载_好玩的安卓游戏下载基地-吾爱下载站 | 雄松华章(广州华章MBA)官网-专注MBA/MPA/MPAcc/MEM辅导培训 | 太阳能发电系统-太阳能逆变器,控制器-河北沐天太阳能科技首页 | 泥浆在线密度计厂家-防爆数字压力表-膜盒-远传压力表厂家-江苏大亚自控设备有限公司 | 蓝莓施肥机,智能施肥机,自动施肥机,水肥一体化项目,水肥一体机厂家,小型施肥机,圣大节水,滴灌施工方案,山东圣大节水科技有限公司官网17864474793 | 翻斗式矿车|固定式矿车|曲轨侧卸式矿车|梭式矿车|矿车配件-山东卓力矿车生产厂家 | 昆山新莱洁净应用材料股份有限公司-卫生级蝶阀,无菌取样阀,不锈钢隔膜阀,换向阀,离心泵 | 并网柜,汇流箱,电控设备,中高低压开关柜,电气电力成套设备,PLC控制设备订制厂家,江苏昌伟业新能源科技有限公司 | 无硅导热垫片-碳纤维导热垫片-导热相变材料厂家-东莞市盛元新材料科技有限公司 | 贵州水玻璃_-贵阳花溪闽兴水玻璃厂 | 千淘酒店差旅平台-中国第一家针对TMC行业的酒店资源供应平台 | 淘气堡_室内儿童乐园_户外无动力儿童游乐设备-高乐迪(北京) | 安徽成考网-安徽成人高考网 | 恒温振荡混匀器-微孔板振荡器厂家-多管涡旋混匀器厂家-合肥艾本森(www.17world.net) | 旅游规划_旅游策划_乡村旅游规划_景区规划设计_旅游规划设计公司-北京绿道联合旅游规划设计有限公司 | 中空玻璃生产线,玻璃加工设备,全自动封胶线,铝条折弯机,双组份打胶机,丁基胶/卧式/立式全自动涂布机,玻璃设备-山东昌盛数控设备有限公司 | 播音主持培训-中影人教育播音主持学苑「官网」-中国艺考界的贵族学校 | 金库门,金库房,金库门厂家,金库门价格-河北特旺柜业有限公司 | 欧洲MV日韩MV国产_人妻无码一区二区三区免费_少妇被 到高潮喷出白浆av_精品少妇自慰到喷水AV网站 | 合肥通道闸-安徽车牌识别-人脸识别系统厂家-安徽熵控智能技术有限公司 | 自动检重秤-动态称重机-重量分选秤-苏州金钻称重设备系统开发有限公司 | ISO9001认证咨询_iso9001企业认证代理机构_14001|18001|16949|50430认证-艾世欧认证网 | 生物除臭剂-除味剂-植物-污水除臭剂厂家-携葵环保有限公司 | 步进_伺服_行星减速机,微型直流电机,大功率直流电机-淄博冠意传动机械 | 沈阳楼承板_彩钢板_压型钢板厂家-辽宁中盛绿建钢品股份有限公司 轴承振动测量仪电箱-轴承测振动仪器-测试仪厂家-杭州居易电气 |