1

嗨,我一直在尝试使用 chaquopy 来运行我的 python 脚本,但我在导入部分遇到了麻烦。当我运行不需要任何外部库并且不使用您将在 build.gradle 中编写的安装代码的脚本时,它工作正常。

        python{
            pip{
                install "numpy"
            }
        }

一旦我将安装代码滑入,问题就出现了。它出现了下面写的错误消息。

> Task :app:generateDebugPythonRequirements
C:\Users\q\AndroidStudioProjects\Chaquopy_Practice\app\build\generated\python\bp.zip\pip\_vendor\ipaddress.py:1106: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
C:\Users\q\AndroidStudioProjects\Chaquopy_Practice\app\build\generated\python\bp.zip\pip\_vendor\ipaddress.py:1106: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
Chaquopy: Installing for armeabi-v7a
C:\Users\q\AndroidStudioProjects\Chaquopy_Practice\app\build\generated\python\bp.zip\pip\_vendor\ipaddress.py:1106: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
C:\Users\q\AndroidStudioProjects\Chaquopy_Practice\app\build\generated\python\bp.zip\pip\_vendor\ipaddress.py:1106: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Looking in indexes: https://pypi.org/simple, https://chaquo.com/pypi-7.0
Collecting numpy
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  Could not fetch URL https://pypi.org/simple/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/numpy/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /pypi-7.0/numpy/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /pypi-7.0/numpy/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /pypi-7.0/numpy/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /pypi-7.0/numpy/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /pypi-7.0/numpy/
  Could not fetch URL https://chaquo.com/pypi-7.0/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='chaquo.com', port=443): Max retries exceeded with url: /pypi-7.0/numpy/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy
Chaquopy: Exit status 1

我认为 SSLError 发生在其他人身上,但我找不到 SyntaxWarning: 'str' object ~~ 是关于什么的。

4

1 回答 1

1

问题本身不在 pip install 命令中。真正的问题来自使用 anaconda 中的 python.exe 而不是原始的 python.exe。下载 python 3.8.6 并更改 buildpython 路径后,我能够解决该问题。

于 2021-01-06T10:22:31.757 回答