久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

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

問(wèn)題描述

我已經(jīng)被這個(gè)問(wèn)題困擾了好幾個(gè)小時(shí),并且相信我已經(jīng)嘗試了所有方法,除了把我的電腦扔出窗外.

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 上設(shè)置了一個(gè)虛擬環(huán)境.如果我從 Anaconda 激活這個(gè)虛擬環(huán)境,一切都會(huì)順利進(jìn)行.

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

但是,當(dāng)我嘗試從 vscode 終端激活環(huán)境時(shí),我得到了

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 解釋器,但仍然得到錯(cuò)誤的 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

我認(rèn)為這可能與 PYTHONPATH 有關(guān),但嘗試取消設(shè)置和重置,即使我不必?fù)?dān)心 Anaconda 中的這一點(diǎn),因?yàn)樗鼤?huì)自動(dòng)添加:"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']

如您所見(jiàn),它似乎使用的是默認(rèn)的 mac OS python 版本.

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

以前有沒(méi)有其他人遇到過(guò)這個(gè)問(wèn)題?我整天都在扯頭發(fā)試圖解決這個(gè)問(wèn)題

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

推薦答案

我也遇到了同樣的問(wèn)題.終于從論壇(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)后,內(nèi)容會(huì)附加到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.

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

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

相關(guān)文檔推薦

Troubles while parsing with python very large xml file(使用 python 解析非常大的 xml 文件時(shí)出現(xiàn)問(wèn)題)
Find all nodes by attribute in XML using Python 2(使用 Python 2 在 XML 中按屬性查找所有節(jié)點(diǎn))
Python - How to parse xml response and store a elements value in a variable?(Python - 如何解析 xml 響應(yīng)并將元素值存儲(chǔ)在變量中?)
How to get XML tag value in Python(如何在 Python 中獲取 XML 標(biāo)記值)
How to correctly parse utf-8 xml with ElementTree?(如何使用 ElementTree 正確解析 utf-8 xml?)
Parse XML from URL into python object(將 XML 從 URL 解析為 python 對(duì)象)
主站蜘蛛池模板: 91精品一区 | 久久精品伊人 | 国产资源一区二区三区 | 国产精品91久久久久久 | 国产乱精品一区二区三区 | 狠狠狠色丁香婷婷综合久久五月 | 91香蕉视频在线观看 | 日本午夜网 | 爱操av | 国内精品久久久久 | 国产精品99久久免费观看 | 夫妻午夜影院 | 一级视频在线免费观看 | 成人黄色av网站 | 网站一区二区三区 | 国产成人精品一区二区三区网站观看 | 一区二区三区四区视频 | 国产电影一区二区 | 精品成人在线视频 | 国产精品国产三级国产播12软件 | 天天操天天干天天曰 | 99精品国产一区二区三区 | 久久精品视频亚洲 | 久久之精品 | 日韩欧美成人一区二区三区 | 欧美啪啪网站 | 激情五月婷婷在线 | 欧美一级网站 | 欧美激情久久久 | 又爽又黄axxx片免费观看 | 毛片免费视频 | 欧美日韩在线一区二区 | 视频一区二区中文字幕 | 欧美日韩国产中文 | 成人做爰69片免费观看 | 亚洲综合资源 | 欧美激情a∨在线视频播放 成人免费共享视频 | 在线一区视频 | 三级黄色片在线播放 | 欧美成人精品一区二区男人看 | 91精品久久 |