我正在尝试从here安装pysubgroup软件包,以便可以将其导入到Jupiter笔记本中,所以我认为我需要让Anaconda看到它,因为当前在尝试将其导入时出现错误一个笔记本。
import pysubgroup as ps
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-73256517fd70> in <module>
----> 1 import pysubgroup as ps
ModuleNotFoundError: No module named 'pysubgroup'
但是我在这里看到了该模块:
/Users/mymac/anaconda3/bin/pip install git+https://github.com/flemmerich/pysubgroup.git
Collecting git+https://github.com/flemmerich/pysubgroup.git
Cloning https://github.com/flemmerich/pysubgroup.git to /private/var/folders/h7/cb_tknx94mq651k09wj4bkyw0000gn/T/pip-req-build-00t6c_7i
Requirement already satisfied (use --upgrade to upgrade): pysubgroup==0.5.2 from git+https://github.com/flemmerich/pysubgroup.git in /Users/mymac/anaconda3/lib/python3.7/site-packages
在这里:
pip show pysubgroup
Name: pysubgroup
Version: 0.5.2
Summary: pysubgroup is a Python library for the data analysis task of subgroup discovery.
Home-page: http://florian.lemmerich.net/pysubgroup
Author: Florian Lemmerich
Author-email: florian@lemmerich.net
License: UNKNOWN
Location: /Users/mymac/anaconda3/lib/python3.7/site-packages
这显示了我从终端发送的sys.path:
python -m site
sys.path = [
'/Users/mymac',
'/Users/mymac/anaconda3/lib/python37.zip',
'/Users/mymac/anaconda3/lib/python3.7',
'/Users/mymac/anaconda3/lib/python3.7/lib-dynload',
'/Users/mymac/anaconda3/lib/python3.7/site-packages',
'/Users/mymac/anaconda3/lib/python3.7/site-packages/aeosa',
]
USER_BASE: '/Users/mymac/.local' (doesn't exist)
USER_SITE: '/Users/mymac/.local/lib/python3.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: True
这显示了我在笔记本电脑上的sys.path,它略有不同:
['',
'/Users/mymac/Documents/daz-research',
'/Users/mymac/anaconda3/lib/python37.zip',
'/Users/mymac/anaconda3/lib/python3.7',
'/Users/mymac/anaconda3/lib/python3.7/lib-dynload',
'/Users/mymac/anaconda3/lib/python3.7/site-packages',
'/Users/mymac/anaconda3/lib/python3.7/site-packages/aeosa',
'/Users/mymac/anaconda3/lib/python3.7/site-packages/IPython/extensions',
'/Users/mymac/.ipython']
所以我认为关键是要让Jupyter Notebook使用该站点包。
但是我无法在任何环境(包括iPython甚至命令提示符)中导入pysubgroup,如下所示:
Last login: Sat Dec 8 13:35:37 on ttys002
mymac-MacBook-Pro:~ mymac$ python
Python 3.7.0 (default, Jun 28 2018, 07:39:16)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda custom (64-bit) on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysubgroup
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pysubgroup'
>>> quit()
mymac-MacBook-Pro:~ mymac$ python3
Python 3.7.0 (default, Jun 28 2018, 07:39:16)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda custom (64-bit) on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysubgroup
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pysubgroup'
>>>
所以我的问题是:
1)如何获取Jupyter Notebook和其他任何python环境以显示其当前正在使用的站点包
2)如何使Jupyter Notebook和其他python环境使用该站点包
3)这是解决此问题的正确方法吗?