相关疑难解决方法(0)

在ubuntu上将python3.4升级到python3.6会破坏pip

我目前有python3.4后,我正试图在我的机器上安装python3.6.但是,安装后试图pip在python3.6下运行给我错误:

Traceback (most recent call last):
  File "pip3", line 7, in <module>
    from pip import main
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 59, in <module>
    from pip.log import logger
  File "/usr/lib/python3/dist-packages/pip/log.py", line 9, in <module>
    import colorama, pkg_resources
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1520, in <module>
    register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import …
Run Code Online (Sandbox Code Playgroud)

python pip

36
推荐指数
2
解决办法
3万
查看次数

在Linux上使用Python3.6进行回溯的ModuleNotFoundError

我使用Jonathon Fernyhough的PPA 在Ubuntu 16.04上安装了Python 3.6:

sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
Run Code Online (Sandbox Code Playgroud)

我使用新的文字字符串插值创建了一个字符串,但是我提供了一个无效的格式说明符.我不仅得到了预期ValueError: Invalid format specifier,而且出乎意料ModuleNotFoundError: No module named 'apt_pkg'.

$ python3.6
Python 3.6.0 (default, Dec 29 2016, 21:40:36) 
[GCC 5.4.1 20161202] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> value = 4 * 20
>>> f'the value is {value:%A}'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Invalid format specifier
Error in …
Run Code Online (Sandbox Code Playgroud)

exception-handling python-3.x python-3.6

12
推荐指数
3
解决办法
2万
查看次数

如何解决pycharm上的错误“dotenv安装错误”

我正在尝试在 pycharm edu 上安装 dotenv 包,但不断收到错误消息“AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'”

我试图通过以 root 用户身份运行命令“pip install --user dotenv”来使用 python 终端解决这个问题,但仍然遇到相同的错误

命令输出如下

Collecting dotenv
Using cached https://files.pythonhosted.org/packages/e2/46/3754073706e31670eed18bfa8a879305b56a471db15f20523c2427b10078/dotenv-0.0.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 194, in setup_context
    __import__('setuptools')
  File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/setuptools/__init__.py", line 2, in <module>
  File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/setuptools/extension.py", line 5, in <module>
  File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/setuptools/dist.py", line 7, in <module>
  File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/setuptools/command/__init__.py", line 8, in <module>
  File "/tmp/easy_install-vzgpp8in/distribute-0.7.3/setuptools/command/install_scripts.py", line …
Run Code Online (Sandbox Code Playgroud)

python pip dotenv

9
推荐指数
2
解决办法
7486
查看次数

无法在 Windows 上安装 dotenv

我从没想过我会使用 Stack Overflow,但我来了!

我无法在 Windows 上安装 DotEnv,当我pip install dotenv使用其可选标志执行时,会抛出此错误:

Collecting dotenv
  Using cached dotenv-0.0.5.tar.gz (2.4 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Damian Freeman\\AppData\\Local\\Temp\\pip-install-bdy5mww4\\dotenv\\setup.py'"'"'; __file__='"'"'C:\\Users\\Damian Freeman\\AppData\\Local\\Temp\\pip-install-bdy5mww4\\dotenv\\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 'C:\Users\Damian Freeman\AppData\Local\Temp\pip-pip-egg-info-k9desg5s'
         cwd: C:\Users\Damian Freeman\AppData\Local\Temp\pip-install-bdy5mww4\dotenv\
    Complete output (52 lines):
    WARNING: The wheel package is not available.
        ERROR: Command errored out with exit status 1:
         command: 'c:\python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Damian …
Run Code Online (Sandbox Code Playgroud)

python pip dotenv

9
推荐指数
1
解决办法
1万
查看次数

在 Apple Silicon M1 Mac 上安装加密

帮助!我正在尝试在我的 m1 上安装加密。我知道我可以在 rosetta 模式下运行终端,但我想知道是否有办法不这样做。

输出:

    ERROR: Command errored out with exit status 1:
     command: /opt/homebrew/opt/python@3.9/bin/python3.9 /opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/hj/5zfkv68d7lqgrfqt046bn23c0000gn/T/tmpl4sga84k
         cwd: /private/var/folders/hj/5zfkv68d7lqgrfqt046bn23c0000gn/T/pip-install-jko4b562/cryptography_7b1bbc9ece2f481a8e8e9ea03b1a0030
    Complete output (55 lines):
    
        =============================DEBUG ASSISTANCE=============================
        If you are seeing a compilation error please try the following steps to
        successfully install cryptography:
        1) Upgrade to the latest pip and try again. This will fix errors for most
           users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
        2) Read https://cryptography.io/en/latest/installation.html for specific
           instructions for your platform.
        3) Check our frequently asked questions for more information:
           https://cryptography.io/en/latest/faq.html …
Run Code Online (Sandbox Code Playgroud)

python-cryptography apple-silicon apple-m1

8
推荐指数
4
解决办法
3428
查看次数

在 python3 上安装 socketio 模块似乎会破坏 pip

使用 为 python 安装 socketio 包时pip3 install socketio,我得到以下结果:

ERROR: launchpadlib 1.10.13 requires testresources, which is not installed.

WARNING: The scripts easy_install and easy_install-3.8 are installed in '/home/bill/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Successfully installed netifaces-0.10.6 setuptools-3.3 socketio-0.2.1
Run Code Online (Sandbox Code Playgroud)

虽然我能够import socketio成功,但 pip3 似乎已损坏(?)。具体来说,当尝试运行包括 pip3 在内的任何东西时,即使pip3是在终端中单独运行,我也会遇到同样的错误:

Traceback (most recent call last):
  File "/usr/bin/pip3", line 6, in <module>
    from pkg_resources import load_entry_point …
Run Code Online (Sandbox Code Playgroud)

python linux python-3.8

7
推荐指数
1
解决办法
407
查看次数