简体   繁体   English

Python 3.9.0 在 rasberry pi 4 上设置为默认值,但我的 IDE 看不到它

[英]Python 3.9.0 set as default on rasberry pi 4 but my IDE cant see it

I was able to install python 3.9.0 on raspberry 4 and I can verify through the terminal that that has been set as the default python.我能够在 raspberry 4 上安装 python 3.9.0,我可以通过已设置为默认 python 的终端进行验证。 However, 3 different IDEs (idle, thorny and Microsoft visual code) that I am using cannot find the python 3.9.0 but can see 3.7.3 which came with the pi.但是,我使用的 3 个不同的 IDE(空闲、棘手和 Microsoft 可视代码)找不到 python 3.9.0,但可以看到 pi 附带的 3.7.3。 I followed this ( link ) instruction but cannot tell why it is not working.我遵循了这个(链接)指令,但不知道为什么它不起作用。 I will appreciate any help at all.我将不胜感激任何帮助。 Thank you.谢谢你。

I'm not sure but for IDLE you may have to install it with我不确定,但对于IDLE您可能必须安装它

python3.9 -m pip install idle 

or要么

apt install idle-python3.9 

and you should have to run it as你应该运行它

idle-python3.9

so at the same time you should have所以同时你应该有

idle-python3.7 

to run it with Python 3.7Python 3.7运行它


thonny (similar to VS Code ) has Tools > Options > Interpreter or Run > Select Interpreter... . thonny (类似于VS Code )具有Tools > Options > InterpreterRun > Select Interpreter... You may also use你也可以使用

python3.9 -m pip install thonny 

and it should even use python3.9 to run thonny它甚至应该使用python3.9来运行thonny


You should add Python's folder to existing PATH like您应该将 Python 的文件夹添加到现有的PATH例如

export PATH=/usr/local/opt/python-3.9.0/bin:$PATH. 

As I remeber it has to be splited by : and it has to be = without spaces.正如我remeber它必须由被splited :它必须是=没有空格。

You can check你可以检查

echo $PATH 

before you set new value to see if it uses : to separate paths.在设置新值以查看它是否使用:分隔路径之前。

But usually it should create also links但通常它也应该创建链接

/usr/bin/python3.7
/usr/bin/python3.9

/usr/bin/pip3.7
/usr/bin/pip3.9

so it should run without any changes in PATH .所以它应该在没有任何更改的情况下运行PATH
At least I have these links on Linux Mint 20 (based on Ubuntu 20.04 ).至少我在Linux Mint 20 (基于Ubuntu 20.04 )上有这些链接。

You can check if you have你可以检查你是否有

ls -al /usr/bin/python*
ls -al /usr/bin/pip*

and also并且

which python3.7
which python3.9

which pip3.7
which pip3.9

or要么

whereis python

whereis pip

or formatted ( new line instead of space )或格式化( new line而不是space

whereis python | sed 's/ /\n/g'

whereis pip | sed 's/ /\n/g'

Eventually you could create link manually and then you don't have to add folder to PATH最终您可以手动创建链接,然后您不必将文件夹添加到 PATH

sudo ln -s /usr/local/opt/python-3.9.0/bin/python /usr/bin/python3.9

or you could copy (not move) python to /usr/bin/python3.9或者你可以复制(不移动) python/usr/bin/python3.9

sudo cp /usr/local/opt/python-3.9.0/bin/python /usr/bin/python3.9

Every python version should have own pip to install modules only for this version - they don't share modules.每个 python 版本都应该有自己的pip来为这个版本安装模块——它们不共享模块。

You have to install pandas in Python 3.9.0 .您必须在Python 3.9.0安装pandas Check if you have pip3.9检查你是否有pip3.9

pip3.9 install pandas

or use directly python3.9 like或者直接使用python3.9类的

python3.9 -m pip install pandas

You could check你可以检查

pip -V 

pip3 -V 

to see for what version they install modules.查看他们安装模块的版本。


BTW:顺便提一句:

Stackoverflow has special page for Raspberry Pi Stackoverflow有专门的Raspberry Pi页面

https://raspberrypi.stackexchange.com/ https://raspberrypi.stackexchange.com/

Raspberry Pi has also own official forum Raspberry Pi也有自己的官方论坛

https://www.raspberrypi.org/forums/ https://www.raspberrypi.org/forums/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM