我正在构建一个运行代码的环境,代码“import src”不在colab或我的电脑中。我看到了 PyPl 页面,它说我应该运行“pip install src”,但我仍然无法成功。
(base) oblic@oblic-PC:~$ pip install src
Collecting src
Using cached src-0.0.7.zip (6.3 kB)
Building wheels for collected packages: src
Building wheel for src (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/oblic/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qffzaygw/src/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qffzaygw/src/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-m62_ocqn
cwd: /tmp/pip-install-qffzaygw/src/
Complete output (41 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/src
copying src/__init__.py -> …Run Code Online (Sandbox Code Playgroud) 我通过 pip3 安装 mairadb 时收到错误。下面是命令和错误。
sudo pip3 install mariadb
------------------------------------------------------------------
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting mariadb
Using cached mariadb-1.0.0.tar.gz (78 kB)
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-z5vslgxx/mariadb/setup.py'"'"'; __file__='"'"'/tmp/pip-install-z5vslgxx/mariadb/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-hfv4vge6
cwd: /tmp/pip-install-z5vslgxx/mariadb/
Complete output (12 lines):
/bin/sh: 1: mariadb_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-z5vslgxx/mariadb/setup.py", line 26, in <module>
cfg = get_config(options) …Run Code Online (Sandbox Code Playgroud) 我正在使用 Python 3-6.10,该包受Pycld2. 但是当我pip install pycld2在命令提示符或 Jupyter Notebook 中调用时,会出现相同的消息:
**ValueError: path '/home/rmyeid/code/pycld2/bindings/encodings.cc' cannot be absolute**
----------------------------------------
ERROR: Failed building wheel for pycld2
Running setup.py clean for pycld2
Failed to build pycld2
DEPRECATION: Could not build wheels for pycld2 which do not use PEP 517.
pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality.
**A possible replacement is to fix the wheel build issue reported above.
You can …Run Code Online (Sandbox Code Playgroud) 我在安装库时遇到问题urllib。我已经尝试过:
$ python -m pip install urllib
$ pip install urllib.request
$ pip install urllib3
$ pip install urllib2
$ pip install urllib2.request
Run Code Online (Sandbox Code Playgroud)
但它们都不起作用。有人可以告诉我如何安装这个库吗?
我得到的错误是这样的:
ERROR: Could not find a version that satisfies the requirement urllib
ERROR: No matching distribution found for urllib
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用词云可视化数据。但是当我使用时pip install wordcloud,我收到以下错误:
D:\...>pip install wordcloud
Collecting wordcloud
Using cached wordcloud-1.8.1.tar.gz (220 kB)
Requirement already satisfied: numpy>=1.6.1 in c:\users\ameli\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from wordcloud) (1.19.5
)
Requirement already satisfied: pillow in c:\users\ameli\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from wordcloud) (8.1.0)
Requirement already satisfied: matplotlib in c:\users\ameli\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from wordcloud) (3.3.3)
Requirement already satisfied: python-dateutil>=2.1 in c:\users\ameli\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from matplotlib
->wordcloud) (2.8.1)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\ameli\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from matplotlib->w
ordcloud) (1.3.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in c:\users\ameli\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packa
ges (from matplotlib->wordcloud) (2.4.7)
Requirement already satisfied: cycler>=0.10 in c:\users\ameli\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from …Run Code Online (Sandbox Code Playgroud) 使用缓存mysqlclient-2.0.3.tar.gz (88 kB)
ERROR: Command errored out with exit status 1:
command: /home/websiteuser/newenv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] =
'"'"'/tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/setup.py'"'"';
__file__='"'"'/tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/setup.py'"'"'
;f=getattr(tokenize, '"'"'open'"'"', open)
(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-q2ahr_b3
cwd: /tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/
Complete output (15 lines):
/bin/sh: 1: mysql_config: not found
/bin/sh: 1: mariadb_config: not found
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-gtzius4s/mysqlclient_581cfbeeeb974b418354ec534fb82b74/setup_posix.py", line 70, in …Run Code Online (Sandbox Code Playgroud) 我有一个带有 python 3.6.9 的 EC2 Ubuntu 18.04.3 LTS 实例
我尝试使用以下命令安装 pyarrow:
python3 -m pip install pyarrow
Run Code Online (Sandbox Code Playgroud)
但我收到一个错误:
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;
__file__='/tmp/pip-build-3q5nmx81/pyarrow/setup.py';
f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');
f.close();exec(compile(code, __file__, 'exec'))"
install --record /tmp/pip-fgafmfzg-record/install-record.txt
--single-version-externally-managed --compile --user --prefix="
failed with error code 1 in /tmp/pip-build-3q5nmx81/pyarrow/
Run Code Online (Sandbox Code Playgroud)
尝试安装 yarrow 后阅读第一条消息,我看到:
Building wheels for collected packages: pyarrow
Running setup.py bdist_wheel for pyarrow ... error
Run Code Online (Sandbox Code Playgroud)
请问您知道我该如何解决这个问题吗?先感谢您。
我使用以下方法创建了一个虚拟环境:
mkvirtualenv env_name --python=python3.9
Run Code Online (Sandbox Code Playgroud)
然后我尝试从 Pipfile 安装:
pipenv install --dev
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误:
pipenv.patched.notpip._internal.exceptions.UnsupportedPythonVersion: pylint requires Python '~=3.6' but the running Python is 2.7.17
Run Code Online (Sandbox Code Playgroud)
我检查了我的Python版本,它是正确的:
$ python --version
Python 3.9.1
Run Code Online (Sandbox Code Playgroud)
为什么它告诉我我的 python 版本是 2.7.17?当我使用以下命令安装时,不会发生这种情况:
pip install pylint==2.7.2
Run Code Online (Sandbox Code Playgroud) 我正在使用https://courses.cognitiveclass.ai/练习 Docker ,并尝试运行Dockerfile以下内容。
FROM python:3.6.1-alpine
RUN pip install flask
CMD ["python","app.py"]
COPY app.py /app.py
Run Code Online (Sandbox Code Playgroud)
我用来运行的命令Dockerfile
sudo docker image build -t python-hello-world .
Run Code Online (Sandbox Code Playgroud)
当我执行此操作时,它只完成了 1/5 步骤,而 2/5 步骤失败并出现以下错误。
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-dlih6aks/MarkupSafe/
You are using pip version 9.0.1, however version 21.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c pip install flask' returned a non-zero code: 1
Run Code Online (Sandbox Code Playgroud)
我需要添加任何更改吗Dockerfile? …
我有一个 Python 包,其中包含大型 PyTorch 模型检查点。我尝试将那些包含在我的setup.pyas中
package_data = {'mypackage': ['model_weights/*', 'model_weights/sequential_models*']},
Run Code Online (Sandbox Code Playgroud)
现在的问题是,每当我尝试通过源安装时,pip install mypackage/ --no-cache-dir我都会得到一个MemoryError. 我尝试调试并--verbose意识到这发生在
creating '/tmp/pip-wheel-bs29bp6a/tmpp0itbxn1/mypackage-1.0-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'mypackage/model_weights/distilled_model.pt'
adding 'mypackage-1.0.dist-info/RECORD'
Traceback (most recent call last):
...
File "/zhome/1d/8/153438/miniconda3/envs/testenv/lib/python3.9/zipfile.py", line 1127, in write
data = self._compressor.compress(data)
MemoryError
Building wheel for mypackage (PEP 517) ... error
ERROR: Failed building wheel for mypackage
Run Code Online (Sandbox Code Playgroud)
我真的只想安装将文件复制到model_weights/安装目录中。将它们纳入车轮似乎是不可能的。
有没有办法在运行时抑制这一步pip install?该包只会作为源分发,而不会在 PyPI 上分发,因为model_weights文件太大了。
pip ×10
python ×9
anaconda ×1
docker ×1
mariadb ×1
pipenv ×1
python-3.x ×1
python-wheel ×1
pytorch ×1
setuptools ×1
ubuntu ×1
virtualenv ×1
word-cloud ×1