[Share Experiences] deepin UOS Linux Pycharm 自定义 Python3 解释器
Tofloor
poster avatar
zizdong
deepin
Forum Operations
2023-08-04 18:47
Author

转载自:李昊哲小课

本文的方法有一定的风险,请确保电脑数据已备份再进行操作

下载编译安装

sudo apt -y install wget
wget https://www.python.org/ftp/python/3.10.7/Python-3.10.7.tar.xz
tar -xvf Python-3.10.7.tar.xz
cd Python-3.10.7/
sudo ./configure --prefix=/opt/python310 --enable-optimizations
# sudo  ./configure --enable-optimizations
sudo make -j8
sudo make install -j8

修改环境变量

sudo deepin-editor /etc/profile
# 或者
sudo vim /etc/profile
# 追加以下内容
export PYTHON3_HOME=/opt/python310
export PATH=$PYTHON3_HOME/bin:$PATH

修改软连接指向

sudo ln -snf /opt/python310/bin/python3 /usr/bin/python3

升级pip

python3 -m pip install --upgrade pip
pip3 install --upgrade setuptools

Pycharm 自定义 Python3 解释器

1.png

2.png

3.png

4.png

5.png

6.png

7.png

8.png

9.png

10.png

11.png

Reply Favorite View the author
All Replies
1 / 2
To page
阿尼樱奈奈
Moderator
2023-08-04 18:48
#1
It has been deleted!
忘记、过去
deepin
2023-08-04 20:07
#2

随意修改系统默认的 python 环境可能会出问题的吧......尤其是替换了环境变量和软链接

Reply View the author
青稚
Moderator
2023-08-04 20:47
#3
忘记、过去

随意修改系统默认的 python 环境可能会出问题的吧......尤其是替换了环境变量和软链接

对的,建议注明风险

agree

Reply View the author
安洛
deepin
2023-08-04 21:36
#4

几乎所有python开发都有办法在环境中自定义python版本,为什么一定要改系统的呢?

Reply View the author
软件技术就是生产力
deepin
2023-08-05 01:52
#5
The user is banned, and the content is hidden.
安洛
deepin
2023-08-05 03:33
#6
软件技术就是生产力
The user is banned, and the content is hidden.

这种情况下用conda跑或者单独给这个软件设置环境变量就好了。

我这里就有一个小飞机软件依赖python2,一个词典软件 (google-translate-for-goldendict) 依赖python3.7+,一个音乐下载软件 (netease-cloud-music-dl) 依赖python3.0-3.9,然后我系统(manjaro)软件源里面的软件全部都是为python 3.11构建的。python开发的软件依赖不同python版本和库的多了去了,怎么可能通过给系统更换python版本解决。

Reply View the author
软件技术就是生产力
deepin
2023-08-05 03:51
#7
The user is banned, and the content is hidden.
软件技术就是生产力
deepin
2023-08-05 03:58
#8
It has been deleted!
安洛
deepin
2023-08-05 04:15
#9
软件技术就是生产力
The user is banned, and the content is hidden.

觉得conda笨重的应该是没搞懂conda。实际上conda本体很小,大的那些依赖都可以不安装。

我不反对编译python。我反对的是替换系统的python版本。系统仓库源内的所有python软件都是针对系统python版本构建的,替换系统python版本会导致仓库内的软件无法正常运行。况且,系统python再怎么替换也就是一个,实际上完全无法满足不同软件的python需要。

Reply View the author
软件技术就是生产力
deepin
2023-08-05 04:20
#10
The user is banned, and the content is hidden.
安洛
deepin
2023-08-05 04:49
#11
软件技术就是生产力
The user is banned, and the content is hidden.

能够满足自己的需要就叫搞懂。anaconda,miniconda,memba,甚至venv+pip(虽然其中有的名字不叫conda,但是他都写明了是conda替代了),只要能够满足自己的需要就好。

另外我都说了我不反对编译python,我不反对编译python,我不反对编译python。

Reply View the author
安洛
deepin
2023-08-05 05:02
#12
软件技术就是生产力
The user is banned, and the content is hidden.

我反对的是替换系统python。替换系统python风险太高,而且很多人并不清楚这个风险,也不知道如果出问题了要怎么解决。

如果这个需求只能通过替换系统python解决,而且清楚替换python的所有风险和对应的解决方案,那么我一句话都不会说。但事实是,这篇帖子的需求和你的需求都不是必须通过替换系统python解决的,而且帖子闭口不提替换python的风险。这种情况下,很难说这个行为是满足了需要。

Reply View the author
软件技术就是生产力
deepin
2023-08-05 06:02
#13
The user is banned, and the content is hidden.
安洛
deepin
2023-08-05 06:35
#14
软件技术就是生产力
The user is banned, and the content is hidden.

对于这种技术文章我其实也不太认同……我始终认为应该进行风险提示。

另外他这个帖子,原理没怎么说,命令和图片倒是贴得非常详细,有一点基础的人靠复制粘贴都能完成。这种风险操作,又只贴命令不解释的,自己做笔记就算了,做成教程和分享真的很容易误导小白。

Reply View the author
fslong
deepin beta test group
2023-08-05 16:51
#15

vscode+pipenv呀,pycharm又是跟小甲鱼学的吧。

都2023年了,还有依赖问题的包不多了,建议与其多花时间研究如何改系统Python还不如好好研究下替代的包,尽量不那么挑Python版本。

Reply View the author
fslong
deepin beta test group
2023-08-05 16:53
#16
安洛

对于这种技术文章我其实也不太认同……我始终认为应该进行风险提示。

另外他这个帖子,原理没怎么说,命令和图片倒是贴得非常详细,有一点基础的人靠复制粘贴都能完成。这种风险操作,又只贴命令不解释的,自己做笔记就算了,做成教程和分享真的很容易误导小白。

这种小白万一是别的搞错了,然后以为是自己py版本问题,跟着一通操作,然后系统崩了,妙呀。

Reply View the author
软件技术就是生产力
deepin
2023-08-05 22:27
#17
The user is banned, and the content is hidden.
软件技术就是生产力
deepin
2023-08-05 22:31
#18
The user is banned, and the content is hidden.
安洛
deepin
2023-08-06 02:51
#19
软件技术就是生产力
The user is banned, and the content is hidden.

小白走弯路对于教程的提供者并没有什么好处。前人踩坑的意义不正是为了为后来人排雷吗?如果每个人都要走一模一样的弯路,浪费一模一样的时间,那人类如何进步?

Reply View the author
安洛
deepin
2023-08-06 02:54
#20
软件技术就是生产力
The user is banned, and the content is hidden.

他不说,所以我说;如果小白往下拉看到我的回复,也许就能知道这样做的风险,也许就能避免系统崩溃所带来的时间与财产损失。

Reply View the author
1 / 2
To page