首页 技术 正文
技术 2022年11月14日
0 收藏 566 点赞 4,288 浏览 1264 个字

在我们正确配置了Keras使用GPU,并在Terminal中运行一切顺利的的时候,转到Pycharm或者Eclipse中运行有可能会出现“nvcc not found on the $PATH”.这是为什么呢?
引用下面一段话或许大家会明白:

you should probably know that all environment variables are inherited. When you define environment variable in your .bash_profile it becomes available in your terminal (bash), and in all processes that will be started from terminal (These processes will be children for the bash process). That’s why you are getting expected values when running your script from within the terminal.

You start PyCharm not from a terminal, so it doesn’t inherit PATH. And so do Python or venv (they launched from PyCharm).

To solve your issue you have 3 options here: just start PyCharm from terminal or move PATH variable definition from .bash_profile to session init scripts (PATH will be defined system-wide) or Duplicate your PATH in PyCharm’s run configuration (it has such option over there)

Good luck!

翻译一下:

在linux中所有的环境变量都是继承过来的,如果我们在.bash_profile中定义了一个环境变量,那么它会在在终端以及所有从终端启动的程序中生效。
但是如果Pycharm不是使用命令从终端启动的,那么他就不会继承这一环境变量,所以我们可以通过从终端启动Pycharm来解决这个问题,eclipse的情况一样。

解决方法:

Use “Tools | Create Command-line Launcher” in PyCharm. This lets you choose the name of the script that will be used to start PyCharm.

参考:
http://stackoverflow.com/questions/21486528/environment-path-different-when-using-venv/21488010#21488010

http://stackoverflow.com/questions/38280081/how-can-i-launch-pycharm-from-terminal-to-use-it-with-ros

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,154
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,623
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,465
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,239
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,874
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,042