Anaconda - 安装包到基础虚拟环境但不能 运行 Spyder,pycharm 或 Jupiter notebook
Anaconda - installed package to base virtual env but can't run in Spyder, pycharm or Jupiter notebook
我打开了一个新的终端并且运行
conda activate base
pip install sailthru-client
然后我打开Spyder尝试导入:
from sailthru.sailthru_client import SailthruClient
但看到:
File "/Users/me/sailthru.py", line 9, in <module>
from sailthru.sailthru_client import SailthruClient
ModuleNotFoundError: No module named 'sailthru.sailthru_client'; 'sailthru' is not a package
在我的终端中,如果我 运行 echo $PATH 我看到:
/opt/anaconda3/bin:/Applications/SnowSQL.app/Contents/MacOS:/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
如果我 运行:
也在我的终端中
python3
from sailthru.sailthru_client import SailthruClient
我明白了:
Traceback (most recent call last): File "", line 1, in
File "/Users/me/sailthru.py", line 3, in
from sailthru.sailthru_client import SailthruClient ModuleNotFoundError: No module named 'sailthru.sailthru_client';
'sailthru' is not a package
File "/Users/me/sailthru.py"
<- 您已通过创建同名的 python 脚本来隐藏模块 sailthru
。重命名并重试
我打开了一个新的终端并且运行
conda activate base
pip install sailthru-client
然后我打开Spyder尝试导入:
from sailthru.sailthru_client import SailthruClient
但看到:
File "/Users/me/sailthru.py", line 9, in <module>
from sailthru.sailthru_client import SailthruClient
ModuleNotFoundError: No module named 'sailthru.sailthru_client'; 'sailthru' is not a package
在我的终端中,如果我 运行 echo $PATH 我看到:
/opt/anaconda3/bin:/Applications/SnowSQL.app/Contents/MacOS:/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
如果我 运行:
也在我的终端中python3
from sailthru.sailthru_client import SailthruClient
我明白了:
Traceback (most recent call last): File "", line 1, in File "/Users/me/sailthru.py", line 3, in from sailthru.sailthru_client import SailthruClient ModuleNotFoundError: No module named 'sailthru.sailthru_client'; 'sailthru' is not a package
File "/Users/me/sailthru.py"
<- 您已通过创建同名的 python 脚本来隐藏模块 sailthru
。重命名并重试