91 lines
3.2 KiB
Markdown
91 lines
3.2 KiB
Markdown
UPBOT-Tool环境配置和运行
|
||
|
||
1.anaconda prompt创建虚拟环境
|
||
|
||
参考:[使用Pycharm和Anaconda配置Python环境图文详解教程——小白逐步操作版_pycharm anaconda配置-CSDN博客](https://blog.csdn.net/loushangfengjing/article/details/136639396)
|
||
|
||
conda create -n upbot python=3.7
|
||
|
||
![image-20241107134130398](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071341482.png)
|
||
|
||
激活新的环境,并验证:
|
||
|
||
![1730958201908](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071343733.png)
|
||
|
||
在pycharm中打开项目:
|
||
|
||
![image-20241107134456663](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071344788.png)
|
||
|
||
选择虚拟环境:file->setting->project:upbot->python interpreter
|
||
|
||
![image-20241107134646835](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071346110.png)
|
||
|
||
选择show all,然后:
|
||
|
||
![8179d4508d9ec040beaeaa84e7d41562](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071349100.png)
|
||
|
||
选择自己刚刚创建的虚拟环境:
|
||
|
||
![image-20241107135040551](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071350604.png)
|
||
|
||
此时就已经配置好了。
|
||
|
||
安装pyqt5:
|
||
|
||
在anaconda prompt输入:
|
||
|
||
pip install PyQt5 -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||
|
||
pip install PyQt5-tools -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||
|
||
使用清华源的时候建议把clash关掉,不然可能会出现问题。
|
||
|
||
看到pycharm中正在加载:
|
||
|
||
![image-20241107140519237](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071405327.png)
|
||
|
||
此时已经下载完成。
|
||
|
||
|
||
|
||
下载pyserial:
|
||
|
||
在anaconda prompt中输入:
|
||
|
||
conda install -c anaconda pyserial
|
||
|
||
![image-20241107140845513](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071408576.png)
|
||
|
||
pip list查看:
|
||
|
||
![image-20241107141319167](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071413227.png)
|
||
|
||
导出:pip freeze > ./requirements.txt
|
||
|
||
![image-20241107141335946](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071413005.png)
|
||
|
||
尝试启动,此时在main.py中修改端口,我的环境中是COM6:
|
||
|
||
![image-20241107171322019](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071713063.png)
|
||
|
||
![1730970741880](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071712628.png)
|
||
|
||
![image-20241107171404093](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071714132.png)
|
||
|
||
但是app.py无法正常运行,提示缺少qdarkstyle软件包:
|
||
|
||
![image-20241107171432901](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071714965.png)
|
||
|
||
在anaconda prompt中安装即可:conda install -c anaconda qdarkstyle
|
||
|
||
又遇到了bug:
|
||
|
||
![image-20241107171703337](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071717386.png)
|
||
|
||
是因为之前打开了main.py会占用端口,关闭main.py既可以了。
|
||
|
||
在弹出的页面中调整motor1,2 可以使两个轮子运动:
|
||
|
||
![image-20241107172445506](https://raw.githubusercontent.com/wwjiefei/pictureBed/main/202411071724546.png)
|
||
|
||
motor1为左轮,motor2为右轮。 |