Pycharm 2to3配置,python2转python3方式
作者:Jenrey 时间:2021-07-05 21:39:50
找到python3的安装路径
python3自带一个把python2代码转换成python3代码的程序,叫"2to3"
我们这里就只需要把该程序配置到pycharm中即可。
配置pycharm
添加自定义工具
pyCharm菜单栏–>「File」–>「Settings」–>「Tools」–>「External Tools」–>点击加号添加工具。
把2to3配置进去
注意:Parameters
请按照python实际路径填写
Program:$ModuleSdkPath$
Parameters:/usr/local/Cellar/python@3.7/3.7.10_3/bin/2to3 -w "$FileDir$"
Working directory:$FileDir$
在pycharm中使用2to3
完成后可以在「菜单栏」–>「Tools」–>「Extern Tools」下使用。
小技巧
由于每次2to3都会生成一个bak备份文件,如果不需要这个备份可以在参数里添加-n
即可。
来源:https://jenrey.blog.csdn.net/article/details/121282797
标签:Pycharm,2to3,python2,python3
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
pyinstaller打包后,配置文件无法正常读取的解决
2022-12-17 18:22:09
手把手带你了解Python数据分析--matplotlib
2022-05-21 22:07:18
![](https://img.aspxhome.com/file/2023/4/87654_0s.png)
NumPy 如何生成多维数组的方法
2022-06-26 20:40:51
有时用户并不需要引导
2009-07-17 18:48:00
![](https://img.aspxhome.com/file/UploadPic/20097/17/ceshi-96s.png)
python计算时间差的方法
2023-05-19 16:08:23
python tkinter 做个简单的计算器的方法
2023-12-20 18:18:27
![](https://img.aspxhome.com/file/2023/7/99467_0s.png)
python网络编程之文件下载实例分析
2021-06-04 08:02:29
python 用opencv实现图像修复和图像金字塔
2022-09-27 09:24:22
![](https://img.aspxhome.com/file/2023/9/83929_0s.png)
Python捕捉和模拟鼠标事件的方法
2022-02-14 11:17:24
OpenCV 之按位运算举例解析
2023-04-15 02:07:57
详解Open Folder as PyCharm Project怎么添加的方法
2021-06-25 05:56:53
![](https://img.aspxhome.com/file/2023/4/115224_0s.png)
利用python numpy+matplotlib绘制股票k线图的方法
2022-12-16 07:21:52
![](https://img.aspxhome.com/file/2023/0/67880_0s.jpg)
python Web开发你要理解的WSGI & uwsgi详解
2021-02-04 08:46:38
![](https://img.aspxhome.com/file/2023/1/72981_0s.png)
网站中美好的细节
2011-07-13 18:43:07
简单form标准化实例——语义结构
2007-06-20 16:32:00
python中Event实现线程间同步介绍
2023-08-18 07:07:08
![](https://img.aspxhome.com/file/2023/9/76789_0s.png)
python数据分析之公交IC卡刷卡分析
2022-02-10 02:23:56
![](https://img.aspxhome.com/file/2023/5/75145_0s.png)
如何创建一个Flask项目并进行简单配置
2023-08-19 01:05:47
PHP实现ASCII码与字符串相互转换的方法
2023-09-09 13:27:05
使用python-opencv读取视频,计算视频总帧数及FPS的实现
2022-02-03 06:55:34