在Linux下安装Anaconda和Pytorch

参考:https://blog.csdn.net/qq_39547794/article/details/124353667

1.输入ubuntu-drivers devices不显示

参考:https://blog.csdn.net/qq_44666320/article/details/107457295
什么是PPA:https://blog.csdn.net/aw77520/article/details/120194368
但是按照上面方法加入了graphics-drivers的ppa源之后,输入ubuntu-drivers devices还是没有显示。

2.没有NVIDIA显卡如何安装Pytorch

lspci | grep VGA

看到自己的显卡是Intel Corporation Iris Plus Graphics G7,这是一个集成显卡。
参考:https://www.csdn.net/tags/NtjakgwsODYwNzctYmxvZwO0O0OO0O0O.html
其实也简单,在官网下载CPU版本的pytorch就行了。

3.报错

(省略)/lib/python3.8/site-packages/torchvision/io/image.py:11: UserWarning: Failed to load image Python extension: (省略)/lib/python3.8/site-packages/torchvision/image.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKSs
warn(f"Failed to load image Python extension: {e}")
但是似乎不影响使用,只是warn.先不解决了。

3.关联vscode

根据参考的博客,在python select interpreter里面选择了自己创建的虚拟环境。选择conda环境之后,vscode提示建议关掉inheritEnv:
https://code.visualstudio.com/updates/v1_36#_launch-terminals-with-clean-environments)

Launch terminals with clean environments#
The Integrated Terminal in VS Code has always acted a little differently to normal terminals, particularly on Linux and macOS. The reason is that the environment was always inherited from VS Code's window (instance) and VS Code/Electron-related environment variables were removed, whereas a normal terminal would typically be launched from the Dock/Start menu and use the system environment. This could cause issues in certain scenarios, for example Python virtual environments were broken because of how they use the $PATH variable.

There's a new preview option, terminal.integrated.inheritEnv, that when false causes the terminal to not use VS Code's environment.

Instead, depending on the platform, it will do the following:

Linux: Fetch and use the environment of the parent process of VS Code's "main process".
macOS: Pull a handful of important environment variables off the current environment and only include them. Eventually we would like macOS to behave the same as Linux but there are currently issues with fetching environments.
Windows: Currently this setting does not affect Windows.
The main visible result of setting inheritEnv to false is that $SHLVL (shell level) should now be 1 and $PATH should not include duplicate paths, provided your launch scripts don't intentionally include them.

The default value for terminal.integrated.inheritEnv is true, which is the previous behavior, but we will probably switch the value to false in the future.

posted on 2022-07-18 10:18  Narh  阅读(242)  评论(0编辑  收藏  举报

导航