Skip to content

Commit

Permalink
Remove hacks to dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
hankcs committed Jan 14, 2025
1 parent 5a55afc commit b0ec2d6
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,8 @@
import sys
from setuptools import find_packages, setup


def browser_open(url='https://nlp.hankcs.com/download.php?file=install'):
try:
import webbrowser
webbrowser.open_new_tab(url)
except:
pass


JPYPE = 'jpype1>=1.5.0' if sys.version_info >= (3, 8) else 'jpype1==0.7.0'

try:
import subprocess

command = 'pip install ' + JPYPE
subprocess.run(
[sys.executable, "-m"] + command.split(" "),
check=True,
)
except:
browser_open()
errors = ['{} 安装失败'.format(JPYPE)]
sys.exit(
'''
----------------------------------------
{}。请执行如下命令:
conda install -c conda-forge python=3.8 openjdk {} -y
pip install pyhanlp
详细安装教程:https://nlp.hankcs.com/download.php?file=install
Windows傻瓜安装包:https://nlp.hankcs.com/download.php?file=exe
'''.format(','.join(errors), JPYPE))

if sys.version_info[0] < 3: # In Python3 TypeError: a bytes-like object is required, not 'str'
long_description = 'Python wrapper for HanLP: Han Language Processing'
else:
Expand Down

0 comments on commit b0ec2d6

Please sign in to comment.