前言:接触python语言没多久,就被朋友拉着解决python项目的运行问题,好在一些基本的东西还是懂一些,因此在和朋友的互相探讨中,写作完成了此篇文章,也就此做个记录,希望为未来踩坑的小伙伴,多一些提示和借鉴的资料
1、conda安装和使用
conda获取地址:
链接:百度网盘 请输入提取码 提取码:mefg --来自百度网盘超级会员V2的分享
说明:Anaconda是一个管理python环境的一个工具,可以通过他创建虚拟环境并拉取所需的安装包,其中的Ancando navicate 是可视化管理界面, Ancando promote是命令操作窗口
2、conda命令行和使用实例
conda env list //查看环境列表 conda activate +环境名 激活环境 conda list 查看包列表 conda install -c +包名 远程拉包
具体实例1——安装gdal
方法1:在线安装
1.百度搜索安库命令
conda install -c conda-forge gdal
2、Andocando promt中添加
成功案例:
方法二:离线安装:
通过下载离线包进行安装 python的所有库:https://www.lfd.uci.edu/~gohlke/pythonlibs/
打开网址后找到自己要安装的库的名称,并下载与自己python版本和电脑对应的库。
最后一步:输入conda install(空一格) +刚才复制的文件名,如下所示:
conda install numpy-1.22.4+vanilla-cp38-cp38-win_amd64.whl
回车进行安装即可成功。如果依然出现问题,可以把命令中的conda换成pip
即:pip install numpy-1.22.4+vanilla-cp38-cp38-win_amd64.whl
具体实例2——使用ifcOpenShell
2.1.1、百度搜索命令
conda install -c conda-forge -c oce -c dlr-sc -c ifcopenshell ifcopenshell
2.1.2、使用conda创建并激活环境
页面创建
检查并激活环境
拉取ifcopenshell
安装成功
pycharm使用:在安装好的pycharm中添加解释器
代码实例:
import ifcopenshell def print_hi(name): ifc_file = ifcopenshell.open(r'E:\IFCExplore\resource\wowo.ifc') products = ifc_file.by_type('IfcProduct') wall = ifc_file.by_type('IfcWall')[0] print("第一根构件的名称是" + wall.GlobalId) print("第一根构件的名字是" + wall.Name) # products = ifc_file.by_type('IfcProduct') for product in products: print("文件中含有以下几种产品:" + product.is_a()) # Press the green button in the gutter to run the script. if __name__ == '__main__': print_hi('PyCharm')
具体实例3——花卉识别窗口,待更新
3、conda镜像源
清华镜像源:ok
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/ conda config --set show_channel_urls yes
中科大镜像源:
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/ conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/ conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/ conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/ conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/ conda config --set show_channel_urls yes
参考资料:Anaconda如何安装库(包)?_草东街Party的博客-优快云博客_anaconda安装库
python应用ifcopenshell:IfcOpenShell-Python 简单应用-1_我们的武平工作室的博客-优快云博客_ifcopenshell
PythonOCC:PythonOCC安装步骤与注意事项_我们的武平工作室的博客-优快云博客_pythonocc安装
ifcopenshell社区:IfcOpenShell Optimizer tutorial | IfcOpenShell Academy
ifcopenshell官网:IfcOpenShell