Finology 大数据金融

通过大数据以量化金融

mamba install 需要指定渠道 -c pytorch

在 jupyter lab 中加载 pytorch 相关包时,控制台报错:

1
2
OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.

在虚拟环境下面的 \Library\bin 下面,找到 libiomp5md.dll 文件,改个名字就可以了。

查看 conda 的版本:conda -V

conda 4.x 版本,提示要升级到 23.x 版本,使用 conda update conda 失效,提示很多包冲突。

使用 conda list -r,然后回退到前面的版本。conda install --revision 0,也不行。

遇到这种情况,是conda的版本太低了,直播删除软件,重新安装 anaconda 就行了。

使用 conda env list 出现一些没有名字的环境,直播删除文件夹,如果还不行,修改用户目录下面的 .conda\environments.txt 文件,把不要环境的内容删除就行了。(windows环境)

环境创建好以后,在这个环境里面会默认安装 pip 的,通过 pip -V 可以查看版本及安装路径信息。

java springboot 项目,配置单元测试,并要求到达一定的代码覆盖率。

在 maven pom.xml 文件中,需要注意以下几点。

跳过测试阶段改为false。

1
2
3
<properties>
<maven.test.skip>false</maven.test.skip>
</properties>

build 阶段,skip 要改为 false。

如果只要单元测试指定类,就在 include 标签里面指定。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<skip>false</skip>
<includes>
<include>**/XXXTest</include> <!-- 替换为您的测试类路径 -->
</includes>
</configuration>
</plugin>
</plugins>
</build>

配置单元测试依赖,mockito-core 如果配置成4版本会有其他问题。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!-- 代码覆盖率 -->
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.12.4</version>
<scope>test</scope>
</dependency>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- jacoco -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

配置结束后,点击 Lifecycle 下面的 test,通过html文件 \target\site\jacoco\index.html 就可以看到覆盖率的页面了

0%